OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/cocoa/browser_window_cocoa.h" |
6 | 6 |
7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #import "chrome/browser/cocoa/theme_install_bubble_view.h" | 33 #import "chrome/browser/cocoa/theme_install_bubble_view.h" |
34 #import "chrome/browser/cocoa/toolbar_controller.h" | 34 #import "chrome/browser/cocoa/toolbar_controller.h" |
35 #include "chrome/browser/download/download_shelf.h" | 35 #include "chrome/browser/download/download_shelf.h" |
36 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 36 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
37 #include "chrome/browser/page_info_window.h" | 37 #include "chrome/browser/page_info_window.h" |
38 #include "chrome/browser/prefs/pref_service.h" | 38 #include "chrome/browser/prefs/pref_service.h" |
39 #include "chrome/browser/profile.h" | 39 #include "chrome/browser/profile.h" |
40 #include "chrome/browser/sidebar/sidebar_container.h" | 40 #include "chrome/browser/sidebar/sidebar_container.h" |
41 #include "chrome/browser/sidebar/sidebar_manager.h" | 41 #include "chrome/browser/sidebar/sidebar_manager.h" |
42 #include "chrome/browser/tab_contents/tab_contents.h" | 42 #include "chrome/browser/tab_contents/tab_contents.h" |
| 43 #include "chrome/browser/tab_contents_wrapper.h" |
43 #include "chrome/common/chrome_switches.h" | 44 #include "chrome/common/chrome_switches.h" |
44 #include "chrome/common/native_web_keyboard_event.h" | 45 #include "chrome/common/native_web_keyboard_event.h" |
45 #include "chrome/common/notification_service.h" | 46 #include "chrome/common/notification_service.h" |
46 #include "chrome/common/pref_names.h" | 47 #include "chrome/common/pref_names.h" |
47 #include "gfx/rect.h" | 48 #include "gfx/rect.h" |
48 #include "grit/chromium_strings.h" | 49 #include "grit/chromium_strings.h" |
49 #include "grit/generated_resources.h" | 50 #include "grit/generated_resources.h" |
50 | 51 |
51 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, | 52 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, |
52 BrowserWindowController* controller, | 53 BrowserWindowController* controller, |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 174 |
174 void BrowserWindowCocoa::ShelfVisibilityChanged() { | 175 void BrowserWindowCocoa::ShelfVisibilityChanged() { |
175 // Mac doesn't yet support showing the bookmark bar at a different size on | 176 // Mac doesn't yet support showing the bookmark bar at a different size on |
176 // the new tab page. When it does, this method should attempt to relayout the | 177 // the new tab page. When it does, this method should attempt to relayout the |
177 // bookmark bar/extension shelf as their preferred height may have changed. | 178 // bookmark bar/extension shelf as their preferred height may have changed. |
178 // http://crbug.com/43346 | 179 // http://crbug.com/43346 |
179 } | 180 } |
180 | 181 |
181 void BrowserWindowCocoa::UpdateDevTools() { | 182 void BrowserWindowCocoa::UpdateDevTools() { |
182 [controller_ updateDevToolsForContents: | 183 [controller_ updateDevToolsForContents: |
183 browser_->tabstrip_model()->GetSelectedTabContents()]; | 184 browser_->GetSelectedTabContents()]; |
184 } | 185 } |
185 | 186 |
186 void BrowserWindowCocoa::UpdateLoadingAnimations(bool should_animate) { | 187 void BrowserWindowCocoa::UpdateLoadingAnimations(bool should_animate) { |
187 // Do nothing on Mac. | 188 // Do nothing on Mac. |
188 } | 189 } |
189 | 190 |
190 void BrowserWindowCocoa::SetStarredState(bool is_starred) { | 191 void BrowserWindowCocoa::SetStarredState(bool is_starred) { |
191 [controller_ setStarredState:is_starred ? YES : NO]; | 192 [controller_ setStarredState:is_starred ? YES : NO]; |
192 } | 193 } |
193 | 194 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } | 237 } |
237 | 238 |
238 void BrowserWindowCocoa::SetFocusToLocationBar(bool select_all) { | 239 void BrowserWindowCocoa::SetFocusToLocationBar(bool select_all) { |
239 [controller_ focusLocationBar:select_all ? YES : NO]; | 240 [controller_ focusLocationBar:select_all ? YES : NO]; |
240 } | 241 } |
241 | 242 |
242 void BrowserWindowCocoa::UpdateReloadStopState(bool is_loading, bool force) { | 243 void BrowserWindowCocoa::UpdateReloadStopState(bool is_loading, bool force) { |
243 [controller_ setIsLoading:is_loading force:force]; | 244 [controller_ setIsLoading:is_loading force:force]; |
244 } | 245 } |
245 | 246 |
246 void BrowserWindowCocoa::UpdateToolbar(TabContents* contents, | 247 void BrowserWindowCocoa::UpdateToolbar(TabContentsWrapper* contents, |
247 bool should_restore_state) { | 248 bool should_restore_state) { |
248 [controller_ updateToolbarWithContents:contents | 249 [controller_ updateToolbarWithContents:contents->tab_contents() |
249 shouldRestoreState:should_restore_state ? YES : NO]; | 250 shouldRestoreState:should_restore_state ? YES : NO]; |
250 } | 251 } |
251 | 252 |
252 void BrowserWindowCocoa::FocusToolbar() { | 253 void BrowserWindowCocoa::FocusToolbar() { |
253 // Not needed on the Mac. | 254 // Not needed on the Mac. |
254 } | 255 } |
255 | 256 |
256 void BrowserWindowCocoa::FocusAppMenu() { | 257 void BrowserWindowCocoa::FocusAppMenu() { |
257 // Chrome uses the standard Mac OS X menu bar, so this isn't needed. | 258 // Chrome uses the standard Mac OS X menu bar, so this isn't needed. |
258 } | 259 } |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 619 |
619 // at this point the controller is dead (autoreleased), so | 620 // at this point the controller is dead (autoreleased), so |
620 // make sure we don't try to reference it any more. | 621 // make sure we don't try to reference it any more. |
621 } | 622 } |
622 | 623 |
623 NSWindow* BrowserWindowCocoa::window() const { | 624 NSWindow* BrowserWindowCocoa::window() const { |
624 return [controller_ window]; | 625 return [controller_ window]; |
625 } | 626 } |
626 | 627 |
627 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { | 628 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { |
628 if (tab_contents == browser_->tabstrip_model()->GetSelectedTabContents()) { | 629 if (tab_contents == browser_->GetSelectedTabContents()) { |
629 [controller_ updateSidebarForContents:tab_contents]; | 630 [controller_ updateSidebarForContents:tab_contents]; |
630 } | 631 } |
631 } | 632 } |
OLD | NEW |