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); | |
Robert Sesek
2015/11/06 15:23:14
This part of your CL has already landed. You shoul
| |
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 | |
195 // Returns playing emoji to be used in production and test code. | |
196 NSString* media_playing_emoji() { return @"🔊"; } | |
Robert Sesek
2015/11/06 15:23:14
I don't think these need accessors at all. Just pl
| |
197 | |
198 // Returns muting emoji to be used in production and test code. | |
199 NSString* media_muting_emoji() { return @"🔇"; } | |
200 | |
183 protected: | 201 protected: |
184 void DestroyBrowser() override; | 202 void DestroyBrowser() override; |
185 | 203 |
186 private: | 204 private: |
187 NSWindow* window() const; // Accessor for the (current) |NSWindow|. | 205 NSWindow* window() const; // Accessor for the (current) |NSWindow|. |
188 | 206 |
189 Browser* browser_; // weak, owned by controller | 207 Browser* browser_; // weak, owned by controller |
190 BrowserWindowController* controller_; // weak, owns us | 208 BrowserWindowController* controller_; // weak, owns us |
191 base::scoped_nsobject<NSString> pending_window_title_; | 209 base::scoped_nsobject<NSString> pending_window_title_; |
192 ui::WindowShowState initial_show_state_; | 210 ui::WindowShowState initial_show_state_; |
193 NSInteger attention_request_id_; // identifier from requestUserAttention | 211 NSInteger attention_request_id_; // identifier from requestUserAttention |
212 | |
213 // Preserves window media state to show appropriate icon in the window title | |
214 // which can be audio playing, muting or none (determined by media state of | |
215 // tabs. | |
216 TabMediaState media_state_; | |
194 }; | 217 }; |
195 | 218 |
196 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ | 219 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ |
OLD | NEW |