| 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" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 extensions::ActiveTabPermissionGranter* GetActiveTabPermissionGranter() | 158 extensions::ActiveTabPermissionGranter* GetActiveTabPermissionGranter() |
| 159 override; | 159 override; |
| 160 | 160 |
| 161 // Overridden from SearchModelObserver: | 161 // Overridden from SearchModelObserver: |
| 162 void ModelChanged(const SearchModel::State& old_state, | 162 void ModelChanged(const SearchModel::State& old_state, |
| 163 const SearchModel::State& new_state) override; | 163 const SearchModel::State& new_state) override; |
| 164 | 164 |
| 165 // Adds the given FindBar cocoa controller to this browser window. | 165 // Adds the given FindBar cocoa controller to this browser window. |
| 166 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); | 166 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); |
| 167 | 167 |
| 168 // Update window media state to show if one of the tabs within the window is | 168 // Updates the window's alert state. If the new alert state is |
| 169 // playing an audio/video or even if it's playing something but it's muted. | 169 // TabAlertState::AUDIO_PLAYING or TabAlertState::AUDIO_MUTING then sets |
| 170 void UpdateMediaState(TabMediaState media_state); | 170 // the window's title to reflect that. |
| 171 void UpdateAlertState(TabAlertState alert_state); |
| 171 | 172 |
| 172 // Returns the cocoa-world BrowserWindowController | 173 // Returns the cocoa-world BrowserWindowController |
| 173 BrowserWindowController* cocoa_controller() { return controller_; } | 174 BrowserWindowController* cocoa_controller() { return controller_; } |
| 174 | 175 |
| 175 // Returns window title based on the active tab title and window media state. | 176 // Returns window title based on the active tab title and the window's alert |
| 177 // state. |
| 176 NSString* WindowTitle(); | 178 NSString* WindowTitle(); |
| 177 | 179 |
| 178 // Returns current media state, determined by the media state of tabs, set by | 180 // Returns the current alert state, determined by the alert state of tabs. Set |
| 179 // UpdateMediaState. | 181 // by UpdateAlertState. |
| 180 TabMediaState media_state() { return media_state_; } | 182 TabAlertState alert_state() { return alert_state_; } |
| 181 | 183 |
| 182 protected: | 184 protected: |
| 183 void DestroyBrowser() override; | 185 void DestroyBrowser() override; |
| 184 | 186 |
| 185 private: | 187 private: |
| 186 NSWindow* window() const; // Accessor for the (current) |NSWindow|. | 188 NSWindow* window() const; // Accessor for the (current) |NSWindow|. |
| 187 | 189 |
| 188 Browser* browser_; // weak, owned by controller | 190 Browser* browser_; // weak, owned by controller |
| 189 BrowserWindowController* controller_; // weak, owns us | 191 BrowserWindowController* controller_; // weak, owns us |
| 190 base::scoped_nsobject<NSString> pending_window_title_; | 192 base::scoped_nsobject<NSString> pending_window_title_; |
| 191 ui::WindowShowState initial_show_state_; | 193 ui::WindowShowState initial_show_state_; |
| 192 NSInteger attention_request_id_; // identifier from requestUserAttention | 194 NSInteger attention_request_id_; // identifier from requestUserAttention |
| 193 | 195 |
| 194 // Preserves window media state to show appropriate icon in the window title | 196 // Preserves window alert state to show appropriate icon in the window title |
| 195 // which can be audio playing, muting or none (determined by media state of | 197 // which can be audio playing, muting or none (determined by alert state of |
| 196 // tabs. | 198 // tabs. |
| 197 TabMediaState media_state_; | 199 TabAlertState alert_state_; |
| 198 }; | 200 }; |
| 199 | 201 |
| 200 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ | 202 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ |
| OLD | NEW |