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_COCOA_BROWSER_WINDOW_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ |
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ |
7 | 7 |
8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/extensions/extension_keybinding_registry.h" | 10 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
11 #include "chrome/browser/signin/chrome_signin_helper.h" | 11 #include "chrome/browser/signin/chrome_signin_helper.h" |
12 #include "chrome/browser/ssl/security_state_model.h" | 12 #include "chrome/browser/ssl/security_state_model.h" |
13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" | 14 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" |
15 #include "chrome/browser/ui/search/search_model_observer.h" | 15 #include "chrome/browser/ui/search/search_model_observer.h" |
| 16 #include "chrome/browser/ui/tabs/tab_utils.h" |
16 #include "components/bookmarks/browser/bookmark_model.h" | 17 #include "components/bookmarks/browser/bookmark_model.h" |
17 #include "ui/base/ui_base_types.h" | 18 #include "ui/base/ui_base_types.h" |
18 | 19 |
19 class Browser; | 20 class Browser; |
20 @class BrowserWindowController; | 21 @class BrowserWindowController; |
21 @class FindBarCocoaController; | 22 @class FindBarCocoaController; |
22 @class NSEvent; | 23 @class NSEvent; |
23 @class NSMenu; | 24 @class NSMenu; |
24 @class NSWindow; | 25 @class NSWindow; |
25 | 26 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 extensions::ActiveTabPermissionGranter* GetActiveTabPermissionGranter() | 171 extensions::ActiveTabPermissionGranter* GetActiveTabPermissionGranter() |
171 override; | 172 override; |
172 | 173 |
173 // Overridden from SearchModelObserver: | 174 // Overridden from SearchModelObserver: |
174 void ModelChanged(const SearchModel::State& old_state, | 175 void ModelChanged(const SearchModel::State& old_state, |
175 const SearchModel::State& new_state) override; | 176 const SearchModel::State& new_state) override; |
176 | 177 |
177 // Adds the given FindBar cocoa controller to this browser window. | 178 // Adds the given FindBar cocoa controller to this browser window. |
178 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); | 179 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); |
179 | 180 |
| 181 // Update window media state to show if one of the tabs within the window is |
| 182 // playing an audio/video or even if it's playing something but it's muted. |
| 183 void UpdateMediaState(TabMediaState media_state); |
| 184 |
180 // Returns the cocoa-world BrowserWindowController | 185 // Returns the cocoa-world BrowserWindowController |
181 BrowserWindowController* cocoa_controller() { return controller_; } | 186 BrowserWindowController* cocoa_controller() { return controller_; } |
182 | 187 |
| 188 // Returns window title based on the active tab title and window media state. |
| 189 NSString* WindowTitle(); |
| 190 |
| 191 // Returns current media state, determined by the media state of tabs, set by |
| 192 // UpdateMediaState. |
| 193 TabMediaState media_state() { return media_state_; } |
| 194 |
183 protected: | 195 protected: |
184 void DestroyBrowser() override; | 196 void DestroyBrowser() override; |
185 | 197 |
186 private: | 198 private: |
187 NSWindow* window() const; // Accessor for the (current) |NSWindow|. | 199 NSWindow* window() const; // Accessor for the (current) |NSWindow|. |
188 | 200 |
189 Browser* browser_; // weak, owned by controller | 201 Browser* browser_; // weak, owned by controller |
190 BrowserWindowController* controller_; // weak, owns us | 202 BrowserWindowController* controller_; // weak, owns us |
191 base::scoped_nsobject<NSString> pending_window_title_; | 203 base::scoped_nsobject<NSString> pending_window_title_; |
192 ui::WindowShowState initial_show_state_; | 204 ui::WindowShowState initial_show_state_; |
193 NSInteger attention_request_id_; // identifier from requestUserAttention | 205 NSInteger attention_request_id_; // identifier from requestUserAttention |
| 206 |
| 207 // Preserves window media state to show appropriate icon in the window title |
| 208 // which can be audio playing, muting or none (determined by media state of |
| 209 // tabs. |
| 210 TabMediaState media_state_; |
194 }; | 211 }; |
195 | 212 |
196 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ | 213 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ |
OLD | NEW |