Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1312)

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.h

Issue 22429004: Refactor LauncherDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for OpenBrowserUsingShelfOnOhterDisplay fail Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "ash/display/display_controller.h" 14 #include "ash/display/display_controller.h"
15 #include "ash/launcher/launcher_delegate.h" 15 #include "ash/launcher/launcher_delegate.h"
16 #include "ash/launcher/launcher_item_delegate.h"
16 #include "ash/launcher/launcher_model_observer.h" 17 #include "ash/launcher/launcher_model_observer.h"
17 #include "ash/launcher/launcher_types.h" 18 #include "ash/launcher/launcher_types.h"
18 #include "ash/shelf/shelf_layout_manager_observer.h" 19 #include "ash/shelf/shelf_layout_manager_observer.h"
19 #include "ash/shelf/shelf_types.h" 20 #include "ash/shelf/shelf_types.h"
20 #include "ash/shell_observer.h" 21 #include "ash/shell_observer.h"
21 #include "base/basictypes.h" 22 #include "base/basictypes.h"
22 #include "base/compiler_specific.h" 23 #include "base/compiler_specific.h"
23 #include "base/memory/scoped_ptr.h" 24 #include "base/memory/scoped_ptr.h"
24 #include "base/memory/scoped_vector.h" 25 #include "base/memory/scoped_vector.h"
25 #include "base/prefs/pref_change_registrar.h" 26 #include "base/prefs/pref_change_registrar.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 typedef ScopedVector<ChromeLauncherAppMenuItem> ChromeLauncherAppMenuItems; 65 typedef ScopedVector<ChromeLauncherAppMenuItem> ChromeLauncherAppMenuItems;
65 66
66 // ChromeLauncherController manages the launcher items needed for content 67 // ChromeLauncherController manages the launcher items needed for content
67 // windows. Launcher items have a type, an optional app id, and a controller. 68 // windows. Launcher items have a type, an optional app id, and a controller.
68 // This incarnation groups running tabs/windows in application specific lists. 69 // This incarnation groups running tabs/windows in application specific lists.
69 // * Browser app windows have BrowserLauncherItemController, owned by the 70 // * Browser app windows have BrowserLauncherItemController, owned by the
70 // BrowserView instance. 71 // BrowserView instance.
71 // * App shell windows have ShellWindowLauncherItemController, owned by 72 // * App shell windows have ShellWindowLauncherItemController, owned by
72 // ShellWindowLauncherController. 73 // ShellWindowLauncherController.
73 // * Shortcuts have no LauncherItemController. 74 // * Shortcuts have no LauncherItemController.
75 // TODO(simon.hong81): Move LauncherItemDelegate out from
76 // ChromeLauncherController and makes separate subclass with it.
74 class ChromeLauncherController : public ash::LauncherDelegate, 77 class ChromeLauncherController : public ash::LauncherDelegate,
78 public ash::LauncherItemDelegate,
75 public ash::LauncherModelObserver, 79 public ash::LauncherModelObserver,
76 public ash::ShellObserver, 80 public ash::ShellObserver,
77 public ash::DisplayController::Observer, 81 public ash::DisplayController::Observer,
78 public content::NotificationObserver, 82 public content::NotificationObserver,
79 public extensions::AppIconLoader::Delegate, 83 public extensions::AppIconLoader::Delegate,
80 public PrefServiceSyncableObserver, 84 public PrefServiceSyncableObserver,
81 public AppSyncUIStateObserver, 85 public AppSyncUIStateObserver,
82 public ExtensionEnableFlowDelegate, 86 public ExtensionEnableFlowDelegate,
83 public chrome::BrowserListObserver, 87 public chrome::BrowserListObserver,
84 public ash::ShelfLayoutManagerObserver { 88 public ash::ShelfLayoutManagerObserver {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // Returns the extension identified by |app_id|. 262 // Returns the extension identified by |app_id|.
259 const extensions::Extension* GetExtensionForAppID( 263 const extensions::Extension* GetExtensionForAppID(
260 const std::string& app_id) const; 264 const std::string& app_id) const;
261 265
262 // Activates a |window|. If |allow_minimize| is true and the system allows 266 // Activates a |window|. If |allow_minimize| is true and the system allows
263 // it, the the window will get minimized instead. 267 // it, the the window will get minimized instead.
264 void ActivateWindowOrMinimizeIfActive(ui::BaseWindow* window, 268 void ActivateWindowOrMinimizeIfActive(ui::BaseWindow* window,
265 bool allow_minimize); 269 bool allow_minimize);
266 270
267 // ash::LauncherDelegate overrides: 271 // ash::LauncherDelegate overrides:
272 virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE;
273 virtual void OnLauncherCreated(ash::Launcher* launcher) OVERRIDE;
274 virtual void OnLauncherDestroyed(ash::Launcher* launcher) OVERRIDE;
275 virtual ash::LauncherID GetLauncherIDForAppID(
276 const std::string& app_id) OVERRIDE;
277 virtual const std::string& GetAppIDForLauncherID(ash::LauncherID id) OVERRIDE;
278 virtual void PinAppWithID(const std::string& app_id) OVERRIDE;
279 virtual bool IsAppPinned(const std::string& app_id) OVERRIDE;
280 virtual void UnpinAppWithID(const std::string& app_id) OVERRIDE;
281
282 // ash::LauncherItemDelegate overrides:
268 virtual void ItemSelected(const ash::LauncherItem& item, 283 virtual void ItemSelected(const ash::LauncherItem& item,
269 const ui::Event& event) OVERRIDE; 284 const ui::Event& event) OVERRIDE;
270 virtual string16 GetTitle(const ash::LauncherItem& item) OVERRIDE; 285 virtual string16 GetTitle(const ash::LauncherItem& item) OVERRIDE;
271 virtual ui::MenuModel* CreateContextMenu( 286 virtual ui::MenuModel* CreateContextMenu(
272 const ash::LauncherItem& item, aura::RootWindow* root) OVERRIDE; 287 const ash::LauncherItem& item, aura::RootWindow* root) OVERRIDE;
273 virtual ash::LauncherMenuModel* CreateApplicationMenu( 288 virtual ash::LauncherMenuModel* CreateApplicationMenu(
274 const ash::LauncherItem& item, 289 const ash::LauncherItem& item,
275 int event_flags) OVERRIDE; 290 int event_flags) OVERRIDE;
276 virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE;
277 virtual bool IsDraggable(const ash::LauncherItem& item) OVERRIDE; 291 virtual bool IsDraggable(const ash::LauncherItem& item) OVERRIDE;
278 virtual bool ShouldShowTooltip(const ash::LauncherItem& item) OVERRIDE; 292 virtual bool ShouldShowTooltip(const ash::LauncherItem& item) OVERRIDE;
279 virtual void OnLauncherCreated(ash::Launcher* launcher) OVERRIDE;
280 virtual void OnLauncherDestroyed(ash::Launcher* launcher) OVERRIDE;
281 virtual ash::LauncherID GetLauncherIDForAppID(
282 const std::string& app_id) OVERRIDE;
283 virtual const std::string& GetAppIDForLauncherID(ash::LauncherID id) OVERRIDE;
284 virtual void PinAppWithID(const std::string& app_id) OVERRIDE;
285 virtual bool IsAppPinned(const std::string& app_id) OVERRIDE;
286 virtual void UnpinAppWithID(const std::string& app_id) OVERRIDE;
287 293
288 // ash::LauncherModelObserver overrides: 294 // ash::LauncherModelObserver overrides:
289 virtual void LauncherItemAdded(int index) OVERRIDE; 295 virtual void LauncherItemAdded(int index) OVERRIDE;
290 virtual void LauncherItemRemoved(int index, ash::LauncherID id) OVERRIDE; 296 virtual void LauncherItemRemoved(int index, ash::LauncherID id) OVERRIDE;
291 virtual void LauncherItemMoved(int start_index, int target_index) OVERRIDE; 297 virtual void LauncherItemMoved(int start_index, int target_index) OVERRIDE;
292 virtual void LauncherItemChanged(int index, 298 virtual void LauncherItemChanged(int index,
293 const ash::LauncherItem& old_item) OVERRIDE; 299 const ash::LauncherItem& old_item) OVERRIDE;
294 virtual void LauncherStatusChanged() OVERRIDE; 300 virtual void LauncherStatusChanged() OVERRIDE;
295 301
296 // content::NotificationObserver overrides: 302 // content::NotificationObserver overrides:
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 464
459 // Close all windowed V1 applications of a certain extension which was already 465 // Close all windowed V1 applications of a certain extension which was already
460 // deleted. 466 // deleted.
461 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id); 467 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id);
462 468
463 // Move a launcher item ignoring the pinned state changes from |index| to 469 // Move a launcher item ignoring the pinned state changes from |index| to
464 // |target_index|. 470 // |target_index|.
465 void MoveItemWithoutPinnedStateChangeNotification(int source_index, 471 void MoveItemWithoutPinnedStateChangeNotification(int source_index,
466 int target_index); 472 int target_index);
467 473
474 // Register LauncherItemDelegate.
475 void RegisterLauncherItemDelegate();
476
468 static ChromeLauncherController* instance_; 477 static ChromeLauncherController* instance_;
469 478
470 ash::LauncherModel* model_; 479 ash::LauncherModel* model_;
471 480
472 // Profile used for prefs and loading extensions. This is NOT necessarily the 481 // Profile used for prefs and loading extensions. This is NOT necessarily the
473 // profile new windows are created with. 482 // profile new windows are created with.
474 Profile* profile_; 483 Profile* profile_;
475 484
476 IDToItemControllerMap id_to_item_controller_map_; 485 IDToItemControllerMap id_to_item_controller_map_;
477 486
(...skipping 26 matching lines...) Expand all
504 // The owned browser shortcut item. 513 // The owned browser shortcut item.
505 scoped_ptr<BrowserShortcutLauncherItemController> browser_item_controller_; 514 scoped_ptr<BrowserShortcutLauncherItemController> browser_item_controller_;
506 515
507 // If true, incoming pinned state changes should be ignored. 516 // If true, incoming pinned state changes should be ignored.
508 bool ignore_persist_pinned_state_change_; 517 bool ignore_persist_pinned_state_change_;
509 518
510 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); 519 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController);
511 }; 520 };
512 521
513 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ 522 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698