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 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.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/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 36 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
37 #import "chrome/browser/ui/cocoa/nsmenuitem_additions.h" | 37 #import "chrome/browser/ui/cocoa/nsmenuitem_additions.h" |
38 #import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h" | 38 #import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h" |
39 #import "chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.h" | 39 #import "chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.h" |
40 #include "chrome/browser/ui/cocoa/restart_browser.h" | 40 #include "chrome/browser/ui/cocoa/restart_browser.h" |
41 #include "chrome/browser/ui/cocoa/status_bubble_mac.h" | 41 #include "chrome/browser/ui/cocoa/status_bubble_mac.h" |
42 #include "chrome/browser/ui/cocoa/task_manager_mac.h" | 42 #include "chrome/browser/ui/cocoa/task_manager_mac.h" |
43 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 43 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
44 #import "chrome/browser/ui/cocoa/web_dialog_window_controller.h" | 44 #import "chrome/browser/ui/cocoa/web_dialog_window_controller.h" |
45 #import "chrome/browser/ui/cocoa/website_settings/website_settings_bubble_contro
ller.h" | 45 #import "chrome/browser/ui/cocoa/website_settings/website_settings_bubble_contro
ller.h" |
| 46 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
46 #include "chrome/browser/ui/search/search_model.h" | 47 #include "chrome/browser/ui/search/search_model.h" |
47 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 48 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
48 #include "chrome/browser/web_applications/web_app.h" | 49 #include "chrome/browser/web_applications/web_app.h" |
49 #include "chrome/common/chrome_switches.h" | 50 #include "chrome/common/chrome_switches.h" |
50 #include "chrome/common/pref_names.h" | 51 #include "chrome/common/pref_names.h" |
51 #include "components/translate/core/browser/language_state.h" | 52 #include "components/translate/core/browser/language_state.h" |
52 #include "content/public/browser/native_web_keyboard_event.h" | 53 #include "content/public/browser/native_web_keyboard_event.h" |
53 #include "content/public/browser/notification_details.h" | 54 #include "content/public/browser/notification_details.h" |
54 #include "content/public/browser/notification_source.h" | 55 #include "content/public/browser/notification_source.h" |
55 #include "content/public/browser/web_contents.h" | 56 #include "content/public/browser/web_contents.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 [window() miniaturize:controller_]; | 344 [window() miniaturize:controller_]; |
344 } | 345 } |
345 | 346 |
346 void BrowserWindowCocoa::Restore() { | 347 void BrowserWindowCocoa::Restore() { |
347 if (IsMaximized()) | 348 if (IsMaximized()) |
348 [window() zoom:controller_]; // Toggles zoom mode. | 349 [window() zoom:controller_]; // Toggles zoom mode. |
349 else if (IsMinimized()) | 350 else if (IsMinimized()) |
350 [window() deminiaturize:controller_]; | 351 [window() deminiaturize:controller_]; |
351 } | 352 } |
352 | 353 |
353 void BrowserWindowCocoa::EnterFullscreen( | 354 // See browser_window_controller.h for a detailed explanation of the logic in |
354 const GURL& url, FullscreenExitBubbleType bubble_type) { | 355 // this method. |
355 [controller_ enterHTML5FullscreenForURL:url bubbleType:bubble_type]; | 356 void BrowserWindowCocoa::EnterFullscreen(const GURL& url, |
| 357 FullscreenExitBubbleType bubble_type) { |
| 358 if (browser_->fullscreen_controller()->IsWindowFullscreenForTabOrPending()) { |
| 359 [controller_ enterWebContentFullscreenForURL:url bubbleType:bubble_type]; |
| 360 return; |
| 361 } |
| 362 |
| 363 if (url.is_empty()) { |
| 364 [controller_ enterPresentationMode]; |
| 365 } else { |
| 366 [controller_ enterExtensionFullscreenForURL:url bubbleType:bubble_type]; |
| 367 } |
356 } | 368 } |
357 | 369 |
358 void BrowserWindowCocoa::ExitFullscreen() { | 370 void BrowserWindowCocoa::ExitFullscreen() { |
359 [controller_ exitAnyFullscreen]; | 371 [controller_ exitAnyFullscreen]; |
360 } | 372 } |
361 | 373 |
362 void BrowserWindowCocoa::UpdateFullscreenExitBubbleContent( | 374 void BrowserWindowCocoa::UpdateFullscreenExitBubbleContent( |
363 const GURL& url, | 375 const GURL& url, |
364 FullscreenExitBubbleType bubble_type) { | 376 FullscreenExitBubbleType bubble_type) { |
365 [controller_ updateFullscreenExitBubbleURL:url bubbleType:bubble_type]; | 377 [controller_ updateFullscreenExitBubbleURL:url bubbleType:bubble_type]; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED) | 706 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED) |
695 return 0; | 707 return 0; |
696 return 40; | 708 return 40; |
697 } | 709 } |
698 | 710 |
699 void BrowserWindowCocoa::ExecuteExtensionCommand( | 711 void BrowserWindowCocoa::ExecuteExtensionCommand( |
700 const extensions::Extension* extension, | 712 const extensions::Extension* extension, |
701 const extensions::Command& command) { | 713 const extensions::Command& command) { |
702 [cocoa_controller() executeExtensionCommand:extension->id() command:command]; | 714 [cocoa_controller() executeExtensionCommand:extension->id() command:command]; |
703 } | 715 } |
OLD | NEW |