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