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

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

Issue 10392173: Flash window by pulsing their launcher icon state indicator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Some cleanup Created 8 years, 7 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_BROWSER_LAUNCHER_ITEM_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_BROWSER_LAUNCHER_ITEM_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_BROWSER_LAUNCHER_ITEM_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_BROWSER_LAUNCHER_ITEM_CONTROLLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "ash/launcher/launcher_types.h" 11 #include "ash/launcher/launcher_types.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 16 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
17 #include "chrome/browser/ui/views/ash/launcher/launcher_favicon_loader.h" 17 #include "chrome/browser/ui/views/ash/launcher/launcher_favicon_loader.h"
18 #include "ui/aura/window_observer.h"
18 19
19 class Browser; 20 class Browser;
20 class ChromeLauncherController; 21 class ChromeLauncherController;
21 class LauncherFaviconLoader; 22 class LauncherFaviconLoader;
22 class TabContentsWrapper; 23 class TabContentsWrapper;
23 24
24 namespace ash { 25 namespace ash {
25 class LauncherModel; 26 class LauncherModel;
26 } 27 }
27 28
28 namespace aura { 29 namespace aura {
29 class Window; 30 class Window;
30 } 31 }
31 32
32 // BrowserLauncherItemController is responsible for keeping the launcher 33 // BrowserLauncherItemController is responsible for keeping the launcher
33 // representation of a window up to date as the active tab changes. 34 // representation of a window up to date as the active tab changes.
34 class BrowserLauncherItemController : public TabStripModelObserver, 35 class BrowserLauncherItemController : public TabStripModelObserver,
35 public LauncherFaviconLoader::Delegate { 36 public LauncherFaviconLoader::Delegate,
37 public aura::WindowObserver {
36 public: 38 public:
37 // This API is to be used as part of testing only. 39 // This API is to be used as part of testing only.
38 class TestApi { 40 class TestApi {
39 public: 41 public:
40 explicit TestApi(BrowserLauncherItemController* controller) 42 explicit TestApi(BrowserLauncherItemController* controller)
41 : controller_(controller) {} 43 : controller_(controller) {}
42 ~TestApi() {} 44 ~TestApi() {}
43 45
44 // Returns the launcher id for the browser window. 46 // Returns the launcher id for the browser window.
45 ash::LauncherID item_id() const { return controller_->item_id_; } 47 ash::LauncherID item_id() const { return controller_->item_id_; }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 int index, 91 int index,
90 bool user_gesture) OVERRIDE; 92 bool user_gesture) OVERRIDE;
91 virtual void TabChangedAt( 93 virtual void TabChangedAt(
92 TabContentsWrapper* tab, 94 TabContentsWrapper* tab,
93 int index, 95 int index,
94 TabStripModelObserver::TabChangeType change_type) OVERRIDE; 96 TabStripModelObserver::TabChangeType change_type) OVERRIDE;
95 97
96 // LauncherFaviconLoader::Delegate overrides: 98 // LauncherFaviconLoader::Delegate overrides:
97 virtual void FaviconUpdated() OVERRIDE; 99 virtual void FaviconUpdated() OVERRIDE;
98 100
101 // aura::WindowObserver overrides:
102 virtual void OnWindowPropertyChanged(aura::Window* window,
103 const void* key,
104 intptr_t old) OVERRIDE;
105
99 private: 106 private:
100 FRIEND_TEST_ALL_PREFIXES(BrowserLauncherItemControllerTest, PanelItem); 107 FRIEND_TEST_ALL_PREFIXES(BrowserLauncherItemControllerTest, PanelItem);
101 108
102 // Used to identify what an update corresponds to. 109 // Used to identify what an update corresponds to.
103 enum UpdateType { 110 enum UpdateType {
104 UPDATE_TAB_REMOVED, 111 UPDATE_TAB_REMOVED,
105 UPDATE_TAB_CHANGED, 112 UPDATE_TAB_CHANGED,
106 UPDATE_TAB_INSERTED, 113 UPDATE_TAB_INSERTED,
107 }; 114 };
108 115
116 // Updates the launcher item status base on the activation and attention
117 // state of the window.
118 void UpdateItemStatus();
119
109 // Updates the launcher from |tab|. 120 // Updates the launcher from |tab|.
110 void UpdateLauncher(TabContentsWrapper* tab); 121 void UpdateLauncher(TabContentsWrapper* tab);
111 122
112 ash::LauncherModel* launcher_model(); 123 ash::LauncherModel* launcher_model();
113 124
114 // Browser window we're in. 125 // Browser window we're in.
115 aura::Window* window_; 126 aura::Window* window_;
116 127
117 TabStripModel* tab_model_; 128 TabStripModel* tab_model_;
118 129
(...skipping 10 matching lines...) Expand all
129 // ID of the item. 140 // ID of the item.
130 ash::LauncherID item_id_; 141 ash::LauncherID item_id_;
131 142
132 // Loads launcher sized favicons for panels. 143 // Loads launcher sized favicons for panels.
133 scoped_ptr<LauncherFaviconLoader> favicon_loader_; 144 scoped_ptr<LauncherFaviconLoader> favicon_loader_;
134 145
135 DISALLOW_COPY_AND_ASSIGN(BrowserLauncherItemController); 146 DISALLOW_COPY_AND_ASSIGN(BrowserLauncherItemController);
136 }; 147 };
137 148
138 #endif // CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_BROWSER_LAUNCHER_ITEM_CONTROLLER _H_ 149 #endif // CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_BROWSER_LAUNCHER_ITEM_CONTROLLER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698