Skip to content

Commit

Permalink
app_list: move model files to ash.
Browse files Browse the repository at this point in the history
- Moves model files to //ash/app_list/model/.
  mkdir -p ash/app_list/model
  tools/git/move_source_file.py \
    ui/app_list/app_list_item.h \
    ui/app_list/app_list_item.cc \
    ui/app_list/app_list_item_observer.h \
    ui/app_list/app_list_model.h \
    ui/app_list/app_list_model.cc \
    ui/app_list/app_list_item_list.h \
    ui/app_list/app_list_item_list.cc \
    ui/app_list/app_list_item_list_observer.h \
    ui/app_list/app_list_view_state.h \
    ui/app_list/search_result.h \
    ui/app_list/search_result.cc \
    ui/app_list/app_list_folder_item.h \
    ui/app_list/app_list_folder_item.cc \
    ui/app_list/app_list_model_observer.h \
    ui/app_list/search_box_model.h \
    ui/app_list/search_box_model.cc \
    ui/app_list/search_result_observer.h \
    ui/app_list/folder_image.h \
    ui/app_list/folder_image.cc \
    ui/app_list/search_box_model_observer.h \
    ash/app_list/model/
  mkdir -p ash/app_list/model/search
  tools/git/move_source_file.py \
    ui/app_list/search/tokenized_string.h \
    ui/app_list/search/tokenized_string.cc \
    ui/app_list/search/tokenized_string_match.h \
    ui/app_list/search/tokenized_string_match.cc \
    ui/app_list/search/term_break_iterator.h \
    ui/app_list/search/term_break_iterator.cc \
    ui/app_list/search/tokenized_string_char_iterator.h \
    ui/app_list/search/tokenized_string_char_iterator.cc \
    ash/app_list/model/search/
  grep -rl 'APP_LIST_EXPORT' ash/app_list/model/ | xargs sed -i 's/APP_LIST_EXPORT/APP_LIST_MODEL_EXPORT/g'
  grep -rl 'ui/app_list/app_list_export.h' ash/app_list/model/ | xargs sed -i 's/ui\/app_list\/app_list_export.h/ash\/app_list\/model\/app_list_model_export.h/g'

- Creates build files for //ash/app_list/model/:
  - //ash/app_list/model/BUILD.gn
  - //ash/app_list/model/app_list_model_export.h

- Moves source files from //ui/app_list/BUILD.gn to //ash/app_list/model/BUILD.gn

- Adds dependency //ui/app_list:app_list -> //ash/app_list/model:app_list_model

- Adds dependency to //ash/app_list/model in the following DEPS files:
  - //chrome/browser/extensions
  - //chrome/browser/sync
  - //chrome/browser/ui/app_list
  - //ui/app_list

- Includes app_list_export.h in the following files:
  - //ui/app_list/views/search_result_view.h
  - //ui/app_list/views/search_result_container_view.h

- Adds new app_list paths into WATCHLISTS

- Formats changes:
  git cl format

Bug: 733662
Change-Id: Ibd816a5a15d441301ea67119626fd1750b1f9efa
Reviewed-on: https://chromium-review.googlesource.com/777019
Commit-Queue: Jiaquan He <[email protected]>
Reviewed-by: James Cook <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Xiyuan Xia <[email protected]>
Cr-Commit-Position: refs/heads/master@{#517972}
  • Loading branch information
JiaquanHe authored and Commit Bot committed Nov 20, 2017
1 parent 69899ff commit 256e6c6
Show file tree
Hide file tree
Showing 132 changed files with 438 additions and 361 deletions.
3 changes: 2 additions & 1 deletion WATCHLISTS
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
'filepath': 'android_webview/',
},
'app_list': {
'filepath': 'chrome/browser/ui/app_list'\
'filepath': 'ash/app_list'\
'|chrome/browser/ui/app_list'\
'|chrome/browser/ui/ash/app_list'\
'|chrome/browser/ui/views/app_list'\
'|ui/app_list/'
Expand Down
2 changes: 1 addition & 1 deletion ash/app_list/app_list_presenter_delegate_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <memory>

#include "ash/app_list/model/app_list_view_state.h"
#include "ash/app_list/test_app_list_presenter_impl.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/config.h"
Expand All @@ -21,7 +22,6 @@
#include "base/macros.h"
#include "ui/app_list/app_list_features.h"
#include "ui/app_list/app_list_switches.h"
#include "ui/app_list/app_list_view_state.h"
#include "ui/app_list/views/app_list_main_view.h"
#include "ui/app_list/views/app_list_view.h"
#include "ui/app_list/views/search_box_view.h"
Expand Down
48 changes: 48 additions & 0 deletions ash/app_list/model/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

component("app_list_model") {
sources = [
"app_list_folder_item.cc",
"app_list_folder_item.h",
"app_list_item.cc",
"app_list_item.h",
"app_list_item_list.cc",
"app_list_item_list.h",
"app_list_item_list_observer.h",
"app_list_item_observer.h",
"app_list_model.cc",
"app_list_model.h",
"app_list_model_observer.h",
"app_list_view_state.h",
"folder_image.cc",
"folder_image.h",
"search/term_break_iterator.cc",
"search/term_break_iterator.h",
"search/tokenized_string.cc",
"search/tokenized_string.h",
"search/tokenized_string_char_iterator.cc",
"search/tokenized_string_char_iterator.h",
"search/tokenized_string_match.cc",
"search/tokenized_string_match.h",
"search_box_model.cc",
"search_box_model.h",
"search_box_model_observer.h",
"search_result.cc",
"search_result.h",
"search_result_observer.h",
]

defines = [ "APP_LIST_MODEL_IMPLEMENTATION" ]

deps = [
"//base:i18n",
"//cc/paint",
"//components/sync",
"//skia",
"//third_party/icu",
"//ui/base",
"//ui/gfx",
]
}
3 changes: 3 additions & 0 deletions ash/app_list/model/DEPS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include_rules = [
"+components/sync",
]
19 changes: 19 additions & 0 deletions ash/app_list/model/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# App List Model

Design doc: go/move-applist

## Introduction

This directory holds all app list model classes.

Currently the app list is running in the Chrome process but in the future it'll
be moved into Ash. Everything in //ui/app_list is being refactored and migrated
to //ash/app_list.

During the migration we'll have build dependencies changed. The following paths
will depend on this since they're referring to the app list model:

- //chrome/browser/extensions
- //chrome/browser/sync
- //chrome/browser/ui/app_list
- //ui/app_list
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/app_list/app_list_folder_item.h"
#include "ash/app_list/model/app_list_folder_item.h"

#include "ash/app_list/model/app_list_item_list.h"
#include "base/guid.h"
#include "ui/app_list/app_list_item_list.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/image/image_skia.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_
#define UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_
#ifndef ASH_APP_LIST_MODEL_APP_LIST_FOLDER_ITEM_H_
#define ASH_APP_LIST_MODEL_APP_LIST_FOLDER_ITEM_H_

#include <stddef.h>

#include <string>
#include <vector>

#include "ash/app_list/model/app_list_item.h"
#include "ash/app_list/model/app_list_item_list_observer.h"
#include "ash/app_list/model/app_list_item_observer.h"
#include "ash/app_list/model/app_list_model_export.h"
#include "ash/app_list/model/folder_image.h"
#include "base/macros.h"
#include "ui/app_list/app_list_export.h"
#include "ui/app_list/app_list_item.h"
#include "ui/app_list/app_list_item_list_observer.h"
#include "ui/app_list/app_list_item_observer.h"
#include "ui/app_list/folder_image.h"

namespace gfx {
class ImageSkia;
class Rect;
}
} // namespace gfx

namespace app_list {

class AppListItemList;

// AppListFolderItem implements the model/controller for folders.
class APP_LIST_EXPORT AppListFolderItem : public AppListItem,
public FolderImageObserver {
class APP_LIST_MODEL_EXPORT AppListFolderItem : public AppListItem,
public FolderImageObserver {
public:
// The folder type affects folder behavior.
enum FolderType {
Expand All @@ -53,7 +53,8 @@ class APP_LIST_EXPORT AppListFolderItem : public AppListItem,
// the same size of the top item icon.
// The Rect returned is in the same coordinates of |folder_icon_bounds|.
gfx::Rect GetTargetIconRectInFolderForItem(
AppListItem* item, const gfx::Rect& folder_icon_bounds);
AppListItem* item,
const gfx::Rect& folder_icon_bounds);

AppListItemList* item_list() { return item_list_.get(); }
const AppListItemList* item_list() const { return item_list_.get(); }
Expand Down Expand Up @@ -91,4 +92,4 @@ class APP_LIST_EXPORT AppListFolderItem : public AppListItem,

} // namespace app_list

#endif // UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_
#endif // ASH_APP_LIST_MODEL_APP_LIST_FOLDER_ITEM_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/app_list/app_list_item.h"
#include "ash/app_list/model/app_list_item.h"

#include "ash/app_list/model/app_list_item_observer.h"
#include "base/logging.h"
#include "ui/app_list/app_list_item_observer.h"

namespace app_list {

AppListItem::AppListItem(const std::string& id)
: id_(id),
highlighted_(false),
is_installing_(false),
percent_downloaded_(-1) {
}
percent_downloaded_(-1) {}

AppListItem::~AppListItem() {
for (auto& observer : observers_)
Expand Down Expand Up @@ -54,8 +53,7 @@ void AppListItem::RemoveObserver(AppListItemObserver* observer) {
observers_.RemoveObserver(observer);
}

void AppListItem::Activate(int event_flags) {
}
void AppListItem::Activate(int event_flags) {}

const char* AppListItem::GetItemType() const {
static const char* app_type = "";
Expand All @@ -75,17 +73,15 @@ size_t AppListItem::ChildItemCount() const {
}

bool AppListItem::CompareForTest(const AppListItem* other) const {
return id_ == other->id_ &&
folder_id_ == other->folder_id_ &&
name_ == other->name_ &&
short_name_ == other->short_name_ &&
GetItemType() == other->GetItemType() &&
position_.Equals(other->position_);
return id_ == other->id_ && folder_id_ == other->folder_id_ &&
name_ == other->name_ && short_name_ == other->short_name_ &&
GetItemType() == other->GetItemType() &&
position_.Equals(other->position_);
}

std::string AppListItem::ToDebugString() const {
return id_.substr(0, 8) + " '" + name_ + "'"
+ " [" + position_.ToDebugString() + "]";
return id_.substr(0, 8) + " '" + name_ + "'" + " [" +
position_.ToDebugString() + "]";
}

// Protected methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_APP_LIST_APP_LIST_ITEM_H_
#define UI_APP_LIST_APP_LIST_ITEM_H_
#ifndef ASH_APP_LIST_MODEL_APP_LIST_ITEM_H_
#define ASH_APP_LIST_MODEL_APP_LIST_ITEM_H_

#include <stddef.h>

#include <string>

#include "ash/app_list/model/app_list_model_export.h"
#include "base/macros.h"
#include "base/observer_list.h"
#include "components/sync/model/string_ordinal.h"
#include "ui/app_list/app_list_export.h"
#include "ui/gfx/image/image_skia.h"

class FastShowPickler;
Expand All @@ -30,7 +30,7 @@ class AppListModel;

// AppListItem provides icon and title to be shown in a AppListItemView
// and action to be executed when the AppListItemView is activated.
class APP_LIST_EXPORT AppListItem {
class APP_LIST_MODEL_EXPORT AppListItem {
public:
explicit AppListItem(const std::string& id);
virtual ~AppListItem();
Expand Down Expand Up @@ -136,4 +136,4 @@ class APP_LIST_EXPORT AppListItem {

} // namespace app_list

#endif // UI_APP_LIST_APP_LIST_ITEM_H_
#endif // ASH_APP_LIST_MODEL_APP_LIST_ITEM_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/app_list/app_list_item_list.h"
#include "ash/app_list/model/app_list_item_list.h"

#include "ash/app_list/model/app_list_item.h"
#include "base/memory/ptr_util.h"
#include "ui/app_list/app_list_item.h"

namespace app_list {

AppListItemList::AppListItemList() {
}
AppListItemList::AppListItemList() {}

AppListItemList::~AppListItemList() {
}
AppListItemList::~AppListItemList() {}

void AppListItemList::AddObserver(AppListItemListObserver* observer) {
observers_.AddObserver(observer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_APP_LIST_APP_LIST_ITEM_LIST_H_
#define UI_APP_LIST_APP_LIST_ITEM_LIST_H_
#ifndef ASH_APP_LIST_MODEL_APP_LIST_ITEM_LIST_H_
#define ASH_APP_LIST_MODEL_APP_LIST_ITEM_LIST_H_

#include <stddef.h>

#include <memory>
#include <string>
#include <vector>

#include "ash/app_list/model/app_list_item_list_observer.h"
#include "ash/app_list/model/app_list_model_export.h"
#include "base/macros.h"
#include "base/observer_list.h"
#include "components/sync/model/string_ordinal.h"
#include "ui/app_list/app_list_export.h"
#include "ui/app_list/app_list_item_list_observer.h"

namespace app_list {

Expand All @@ -24,7 +24,7 @@ class AppListItem;
// Class to manage items in the app list. Used both by AppListModel and
// AppListFolderItem. Manages the position ordinal of items in the list, and
// notifies observers when items in the list are added / deleted / moved.
class APP_LIST_EXPORT AppListItemList {
class APP_LIST_MODEL_EXPORT AppListItemList {
public:
AppListItemList();
virtual ~AppListItemList();
Expand Down Expand Up @@ -117,4 +117,4 @@ class APP_LIST_EXPORT AppListItemList {

} // namespace app_list

#endif // UI_APP_LIST_APP_LIST_ITEM_LIST_H_
#endif // ASH_APP_LIST_MODEL_APP_LIST_ITEM_LIST_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_APP_LIST_APP_LIST_ITEM_LIST_OBSERVER_H_
#define UI_APP_LIST_APP_LIST_ITEM_LIST_OBSERVER_H_
#ifndef ASH_APP_LIST_MODEL_APP_LIST_ITEM_LIST_OBSERVER_H_
#define ASH_APP_LIST_MODEL_APP_LIST_ITEM_LIST_OBSERVER_H_

#include <stddef.h>

#include "ui/app_list/app_list_export.h"
#include "ash/app_list/model/app_list_model_export.h"

namespace app_list {

class AppListItem;

class APP_LIST_EXPORT AppListItemListObserver {
class APP_LIST_MODEL_EXPORT AppListItemListObserver {
public:
// Triggered after |item| has been added to the list at |index|.
virtual void OnListItemAdded(size_t index, AppListItem* item) {}
Expand All @@ -38,4 +38,4 @@ class APP_LIST_EXPORT AppListItemListObserver {

} // namespace app_list

#endif // UI_APP_LIST_APP_LIST_ITEM_LIST_OBSERVER_H_
#endif // ASH_APP_LIST_MODEL_APP_LIST_ITEM_LIST_OBSERVER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_APP_LIST_APP_LIST_ITEM_OBSERVER_H_
#define UI_APP_LIST_APP_LIST_ITEM_OBSERVER_H_
#ifndef ASH_APP_LIST_MODEL_APP_LIST_ITEM_OBSERVER_H_
#define ASH_APP_LIST_MODEL_APP_LIST_ITEM_OBSERVER_H_

#include "ui/app_list/app_list_export.h"
#include "ash/app_list/model/app_list_model_export.h"

namespace app_list {

class APP_LIST_EXPORT AppListItemObserver {
class APP_LIST_MODEL_EXPORT AppListItemObserver {
public:
// Invoked after item's icon is changed.
virtual void ItemIconChanged() {}
Expand All @@ -32,4 +32,4 @@ class APP_LIST_EXPORT AppListItemObserver {

} // namespace app_list

#endif // UI_APP_LIST_APP_LIST_ITEM_OBSERVER_H_
#endif // ASH_APP_LIST_MODEL_APP_LIST_ITEM_OBSERVER_H_
Loading

0 comments on commit 256e6c6

Please sign in to comment.