| OLD | NEW |
| 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 #include "ui/aura/window_observer.h" |
| 19 | 19 |
| 20 class Browser; | 20 class Browser; |
| 21 class ChromeLauncherController; | 21 class ChromeLauncherController; |
| 22 class LauncherFaviconLoader; | 22 class LauncherFaviconLoader; |
| 23 class TabContents; | 23 class TabContents; |
| 24 typedef TabContents TabContentsWrapper; | |
| 25 | 24 |
| 26 namespace ash { | 25 namespace ash { |
| 27 class LauncherModel; | 26 class LauncherModel; |
| 28 } | 27 } |
| 29 | 28 |
| 30 namespace aura { | 29 namespace aura { |
| 31 class Window; | 30 class Window; |
| 32 } | 31 } |
| 33 | 32 |
| 34 // BrowserLauncherItemController is responsible for keeping the launcher | 33 // BrowserLauncherItemController is responsible for keeping the launcher |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 79 |
| 81 LauncherFaviconLoader* favicon_loader() const { | 80 LauncherFaviconLoader* favicon_loader() const { |
| 82 return favicon_loader_.get(); | 81 return favicon_loader_.get(); |
| 83 } | 82 } |
| 84 | 83 |
| 85 // Call to indicate that the window the tabcontents are in has changed its | 84 // Call to indicate that the window the tabcontents are in has changed its |
| 86 // activation state. | 85 // activation state. |
| 87 void BrowserActivationStateChanged(); | 86 void BrowserActivationStateChanged(); |
| 88 | 87 |
| 89 // TabStripModel overrides: | 88 // TabStripModel overrides: |
| 90 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, | 89 virtual void ActiveTabChanged(TabContents* old_contents, |
| 91 TabContentsWrapper* new_contents, | 90 TabContents* new_contents, |
| 92 int index, | 91 int index, |
| 93 bool user_gesture) OVERRIDE; | 92 bool user_gesture) OVERRIDE; |
| 94 virtual void TabChangedAt( | 93 virtual void TabChangedAt( |
| 95 TabContentsWrapper* tab, | 94 TabContents* tab, |
| 96 int index, | 95 int index, |
| 97 TabStripModelObserver::TabChangeType change_type) OVERRIDE; | 96 TabStripModelObserver::TabChangeType change_type) OVERRIDE; |
| 98 | 97 |
| 99 // LauncherFaviconLoader::Delegate overrides: | 98 // LauncherFaviconLoader::Delegate overrides: |
| 100 virtual void FaviconUpdated() OVERRIDE; | 99 virtual void FaviconUpdated() OVERRIDE; |
| 101 | 100 |
| 102 // aura::WindowObserver overrides: | 101 // aura::WindowObserver overrides: |
| 103 virtual void OnWindowPropertyChanged(aura::Window* window, | 102 virtual void OnWindowPropertyChanged(aura::Window* window, |
| 104 const void* key, | 103 const void* key, |
| 105 intptr_t old) OVERRIDE; | 104 intptr_t old) OVERRIDE; |
| 106 | 105 |
| 107 private: | 106 private: |
| 108 FRIEND_TEST_ALL_PREFIXES(BrowserLauncherItemControllerTest, PanelItem); | 107 FRIEND_TEST_ALL_PREFIXES(BrowserLauncherItemControllerTest, PanelItem); |
| 109 | 108 |
| 110 // Used to identify what an update corresponds to. | 109 // Used to identify what an update corresponds to. |
| 111 enum UpdateType { | 110 enum UpdateType { |
| 112 UPDATE_TAB_REMOVED, | 111 UPDATE_TAB_REMOVED, |
| 113 UPDATE_TAB_CHANGED, | 112 UPDATE_TAB_CHANGED, |
| 114 UPDATE_TAB_INSERTED, | 113 UPDATE_TAB_INSERTED, |
| 115 }; | 114 }; |
| 116 | 115 |
| 117 // Updates the launcher item status base on the activation and attention | 116 // Updates the launcher item status base on the activation and attention |
| 118 // state of the window. | 117 // state of the window. |
| 119 void UpdateItemStatus(); | 118 void UpdateItemStatus(); |
| 120 | 119 |
| 121 // Updates the launcher from |tab|. | 120 // Updates the launcher from |tab|. |
| 122 void UpdateLauncher(TabContentsWrapper* tab); | 121 void UpdateLauncher(TabContents* tab); |
| 123 | 122 |
| 124 ash::LauncherModel* launcher_model(); | 123 ash::LauncherModel* launcher_model(); |
| 125 | 124 |
| 126 // Browser window we're in. | 125 // Browser window we're in. |
| 127 aura::Window* window_; | 126 aura::Window* window_; |
| 128 | 127 |
| 129 TabStripModel* tab_model_; | 128 TabStripModel* tab_model_; |
| 130 | 129 |
| 131 ChromeLauncherController* launcher_controller_; | 130 ChromeLauncherController* launcher_controller_; |
| 132 | 131 |
| 133 // Whether this corresponds to an app or tabbed browser. | 132 // Whether this corresponds to an app or tabbed browser. |
| 134 const Type type_; | 133 const Type type_; |
| 135 | 134 |
| 136 const std::string app_id_; | 135 const std::string app_id_; |
| 137 | 136 |
| 138 // Whether this is associated with an incognito profile. | 137 // Whether this is associated with an incognito profile. |
| 139 const bool is_incognito_; | 138 const bool is_incognito_; |
| 140 | 139 |
| 141 // ID of the item. | 140 // ID of the item. |
| 142 ash::LauncherID item_id_; | 141 ash::LauncherID item_id_; |
| 143 | 142 |
| 144 // Loads launcher sized favicons for panels. | 143 // Loads launcher sized favicons for panels. |
| 145 scoped_ptr<LauncherFaviconLoader> favicon_loader_; | 144 scoped_ptr<LauncherFaviconLoader> favicon_loader_; |
| 146 | 145 |
| 147 DISALLOW_COPY_AND_ASSIGN(BrowserLauncherItemController); | 146 DISALLOW_COPY_AND_ASSIGN(BrowserLauncherItemController); |
| 148 }; | 147 }; |
| 149 | 148 |
| 150 #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_ |
| OLD | NEW |