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