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

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

Issue 2791803002: mash: Move LauncherItemController to ash, rename ShelfItemDelegate. (Closed)
Patch Set: Move shelf_item_delegate to ash/public/cpp, cleanup. Created 3 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "ash/public/cpp/shelf_item_delegate.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 class Browser; 16 class Browser;
17 class URLPattern; 17 class URLPattern;
18 18
19 namespace content { 19 namespace content {
20 class WebContents; 20 class WebContents;
21 } 21 }
22 22
23 namespace extensions { 23 namespace extensions {
24 class Extension; 24 class Extension;
25 } 25 }
26 26
27 class ChromeLauncherController; 27 class ChromeLauncherController;
28 28
29 // Item controller for an app shortcut. Shortcuts track app and launcher ids, 29 // Item controller for an app shortcut. Shortcuts track app and launcher ids,
30 // but do not have any associated windows (opening a shortcut will replace the 30 // but do not have any associated windows (opening a shortcut will replace the
31 // item with the appropriate LauncherItemController type). 31 // item with the appropriate ash::ShelfItemDelegate type).
32 class AppShortcutLauncherItemController : public LauncherItemController { 32 class AppShortcutLauncherItemController : public ash::ShelfItemDelegate {
33 public: 33 public:
34 ~AppShortcutLauncherItemController() override; 34 ~AppShortcutLauncherItemController() override;
35 35
36 static AppShortcutLauncherItemController* Create( 36 static AppShortcutLauncherItemController* Create(
37 const ash::AppLaunchId& app_launch_id, 37 const ash::AppLaunchId& app_launch_id);
38 ChromeLauncherController* controller);
39 38
40 std::vector<content::WebContents*> GetRunningApplications(); 39 std::vector<content::WebContents*> GetRunningApplications();
41 40
42 // LauncherItemController overrides: 41 // ash::ShelfItemDelegate overrides:
43 void ItemSelected(std::unique_ptr<ui::Event> event, 42 void ItemSelected(std::unique_ptr<ui::Event> event,
44 int64_t display_id, 43 int64_t display_id,
45 ash::ShelfLaunchSource source, 44 ash::ShelfLaunchSource source,
46 const ItemSelectedCallback& callback) override; 45 const ItemSelectedCallback& callback) override;
47 MenuItemList GetAppMenuItems(int event_flags) override; 46 ash::MenuItemList GetAppMenuItems(int event_flags) override;
48 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override; 47 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override;
49 void Close() override; 48 void Close() override;
50 49
51 // Get the refocus url pattern, which can be used to identify this application 50 // Get the refocus url pattern, which can be used to identify this application
52 // from a URL link. 51 // from a URL link.
53 const GURL& refocus_url() const { return refocus_url_; } 52 const GURL& refocus_url() const { return refocus_url_; }
54 // Set the refocus url pattern. Used by unit tests. 53 // Set the refocus url pattern. Used by unit tests.
55 void set_refocus_url(const GURL& refocus_url) { refocus_url_ = refocus_url; } 54 void set_refocus_url(const GURL& refocus_url) { refocus_url_ = refocus_url; }
56 55
57 ChromeLauncherController* controller() { return chrome_launcher_controller_; } 56 ChromeLauncherController* controller() { return chrome_launcher_controller_; }
58 57
59 protected: 58 protected:
60 AppShortcutLauncherItemController(const ash::AppLaunchId& app_launch_id, 59 explicit AppShortcutLauncherItemController(
61 ChromeLauncherController* controller); 60 const ash::AppLaunchId& app_launch_id);
62 61
63 private: 62 private:
64 // Get the last running application. 63 // Get the last running application.
65 content::WebContents* GetLRUApplication(); 64 content::WebContents* GetLRUApplication();
66 65
67 // Returns true if this app matches the given |web_contents|. To accelerate 66 // Returns true if this app matches the given |web_contents|. To accelerate
68 // the matching, the app managing |extension| as well as the parsed 67 // the matching, the app managing |extension| as well as the parsed
69 // |refocus_pattern| get passed. If |is_app| is true, the application gets 68 // |refocus_pattern| get passed. If |is_app| is true, the application gets
70 // first checked against its original URL since a windowed app might have 69 // first checked against its original URL since a windowed app might have
71 // navigated away from its app domain. 70 // navigated away from its app domain.
(...skipping 24 matching lines...) Expand all
96 95
97 ChromeLauncherController* chrome_launcher_controller_; 96 ChromeLauncherController* chrome_launcher_controller_;
98 97
99 // The cached list of open app web contents shown in an application menu. 98 // The cached list of open app web contents shown in an application menu.
100 std::vector<content::WebContents*> app_menu_items_; 99 std::vector<content::WebContents*> app_menu_items_;
101 100
102 DISALLOW_COPY_AND_ASSIGN(AppShortcutLauncherItemController); 101 DISALLOW_COPY_AND_ASSIGN(AppShortcutLauncherItemController);
103 }; 102 };
104 103
105 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_ H_ 104 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698