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

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

Issue 9702054: Revert 126764 - Added notion of currently active app / browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
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_VIEWS_ASH_LAUNCHER_LAUNCHER_UPDATER_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_UPDATER_H_
6 #define CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_UPDATER_H_ 6 #define CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_UPDATER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 17 matching lines...) Expand all
28 28
29 namespace aura { 29 namespace aura {
30 class Window; 30 class Window;
31 } 31 }
32 32
33 // LauncherUpdater is responsible for keeping the launcher representation of a 33 // LauncherUpdater is responsible for keeping the launcher representation of a
34 // window up to date as the tab strip changes. 34 // window up to date as the tab strip changes.
35 class LauncherUpdater : public TabStripModelObserver, 35 class LauncherUpdater : public TabStripModelObserver,
36 public LauncherFaviconLoader::Delegate { 36 public LauncherFaviconLoader::Delegate {
37 public: 37 public:
38 // This API is to be used as part of testing only.
39 class TestApi {
40 public:
41 explicit TestApi(LauncherUpdater* launcher_updater)
42 : launcher_updater_(launcher_updater) {}
43 virtual ~TestApi() {}
44
45 // Returns the launcher id for |tab| if it's an app otherwise returns the
46 // id for the browser itself.
47 ash::LauncherID GetLauncherID(TabContentsWrapper* tab) {
48 return launcher_updater_->GetLauncherID(tab);
49 }
50
51 // Returns the launcher id for the browser window.
52 ash::LauncherID item_id() const { return launcher_updater_->item_id_; }
53
54 private:
55 LauncherUpdater* launcher_updater_;
56 };
57
58 enum Type { 38 enum Type {
59 TYPE_APP, 39 TYPE_APP,
60 TYPE_PANEL, 40 TYPE_PANEL,
61 TYPE_TABBED 41 TYPE_TABBED
62 }; 42 };
63 43
64 LauncherUpdater(aura::Window* window, 44 LauncherUpdater(aura::Window* window,
65 TabStripModel* tab_model, 45 TabStripModel* tab_model,
66 ChromeLauncherDelegate* launcher_delegate, 46 ChromeLauncherDelegate* launcher_delegate,
67 Type type, 47 Type type,
(...skipping 13 matching lines...) Expand all
81 61
82 Type type() const { return type_; } 62 Type type() const { return type_; }
83 63
84 TabContentsWrapper* GetTab(ash::LauncherID id); 64 TabContentsWrapper* GetTab(ash::LauncherID id);
85 65
86 LauncherFaviconLoader* favicon_loader() const { 66 LauncherFaviconLoader* favicon_loader() const {
87 return favicon_loader_.get(); 67 return favicon_loader_.get();
88 } 68 }
89 69
90 // TabStripModelObserver overrides: 70 // TabStripModelObserver overrides:
91 void ActivationChanged(TabContentsWrapper* tab, bool active);
92 // Call to indicate that the window the tabcontents are in has changed its
93 // activation state.
94 void BrowserActivationStateChanged();
95
96 // TabStripModel overrides:
97 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, 71 virtual void ActiveTabChanged(TabContentsWrapper* old_contents,
98 TabContentsWrapper* new_contents, 72 TabContentsWrapper* new_contents,
99 int index, 73 int index,
100 bool user_gesture) OVERRIDE; 74 bool user_gesture) OVERRIDE;
101 virtual void TabChangedAt( 75 virtual void TabChangedAt(
102 TabContentsWrapper* tab, 76 TabContentsWrapper* tab,
103 int index, 77 int index,
104 TabStripModelObserver::TabChangeType change_type) OVERRIDE; 78 TabStripModelObserver::TabChangeType change_type) OVERRIDE;
105 virtual void TabInsertedAt(TabContentsWrapper* contents, 79 virtual void TabInsertedAt(TabContentsWrapper* contents,
106 int index, 80 int index,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void RegisterAppItem(ash::LauncherID id, TabContentsWrapper* tab); 123 void RegisterAppItem(ash::LauncherID id, TabContentsWrapper* tab);
150 124
151 // Creates a tabbed launcher item. 125 // Creates a tabbed launcher item.
152 void CreateTabbedItem(); 126 void CreateTabbedItem();
153 127
154 // Returns true if this LauncherUpdater created the launcher item with the 128 // Returns true if this LauncherUpdater created the launcher item with the
155 // specified id. Returns true if it did. If the id corresponds to an app tab, 129 // specified id. Returns true if it did. If the id corresponds to an app tab,
156 // |tab| is set to the TabContentsWrapper for the app tab. 130 // |tab| is set to the TabContentsWrapper for the app tab.
157 bool ContainsID(ash::LauncherID id, TabContentsWrapper** tab); 131 bool ContainsID(ash::LauncherID id, TabContentsWrapper** tab);
158 132
159 // Returns the launcher id for |tab| if it's an app otherwise returns the
160 // id for the browser itself.
161 ash::LauncherID GetLauncherID(TabContentsWrapper* tab);
162
163 // Retrieves the running status of |tab|.
164 ash::LauncherItemStatus GetStatusForTab(TabContentsWrapper* tab);
165
166 ash::LauncherModel* launcher_model(); 133 ash::LauncherModel* launcher_model();
167 134
168 // Browser window we're in. 135 // Browser window we're in.
169 aura::Window* window_; 136 aura::Window* window_;
170 137
171 TabStripModel* tab_model_; 138 TabStripModel* tab_model_;
172 139
173 ChromeLauncherDelegate* launcher_delegate_; 140 ChromeLauncherDelegate* launcher_delegate_;
174 141
175 // Whether this corresponds to an app or tabbed browser. 142 // Whether this corresponds to an app or tabbed browser.
(...skipping 13 matching lines...) Expand all
189 // Used for any app tabs. 156 // Used for any app tabs.
190 AppTabMap app_map_; 157 AppTabMap app_map_;
191 158
192 // Loads launcher sized favicons for panels. 159 // Loads launcher sized favicons for panels.
193 scoped_ptr<LauncherFaviconLoader> favicon_loader_; 160 scoped_ptr<LauncherFaviconLoader> favicon_loader_;
194 161
195 DISALLOW_COPY_AND_ASSIGN(LauncherUpdater); 162 DISALLOW_COPY_AND_ASSIGN(LauncherUpdater);
196 }; 163 };
197 164
198 #endif // CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_UPDATER_H_ 165 #endif // CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_UPDATER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698