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/fullscreen/fullscreen_controller.h" | 5 #include "chrome/browser/ui/fullscreen/fullscreen_controller.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/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
498 tab_fullscreen_accepted_ = toggled_into_fullscreen_ && | 498 tab_fullscreen_accepted_ = toggled_into_fullscreen_ && |
499 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; | 499 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; |
500 } else { | 500 } else { |
501 if (!extension_caused_fullscreen_.is_empty()) | 501 if (!extension_caused_fullscreen_.is_empty()) |
502 url = extension_caused_fullscreen_; | 502 url = extension_caused_fullscreen_; |
503 content::RecordAction(UserMetricsAction("ToggleFullscreen")); | 503 content::RecordAction(UserMetricsAction("ToggleFullscreen")); |
504 } | 504 } |
505 if (toggled_into_fullscreen_) { | 505 if (toggled_into_fullscreen_) { |
506 window_->EnterFullscreen(url, GetFullscreenExitBubbleType()); | 506 window_->EnterFullscreen(url, GetFullscreenExitBubbleType()); |
507 } else { | 507 } else { |
508 window_->ExitFullscreen(); | 508 #if defined(OS_MACOSX) |
scheib
2012/08/03 02:45:58
The #if MAC sections in this file make the logic c
Robert Sesek
2012/08/03 14:44:08
Yes, that's something I want to do. I think most o
| |
509 if (window_->InPresentationMode()) | |
510 window_->ExitPresentationMode(); | |
511 else | |
512 #endif | |
513 window_->ExitFullscreen(); | |
509 extension_caused_fullscreen_ = GURL(); | 514 extension_caused_fullscreen_ = GURL(); |
510 } | 515 } |
511 UpdateFullscreenExitBubbleContent(); | 516 UpdateFullscreenExitBubbleContent(); |
512 | 517 |
513 // Once the window has become fullscreen it'll call back to | 518 // Once the window has become fullscreen it'll call back to |
514 // WindowFullscreenStateChanged(). We don't do this immediately as | 519 // WindowFullscreenStateChanged(). We don't do this immediately as |
515 // BrowserWindow::EnterFullscreen() asks for bookmark_bar_state_, so we let | 520 // BrowserWindow::EnterFullscreen() asks for bookmark_bar_state_, so we let |
516 // the BrowserWindow invoke WindowFullscreenStateChanged when appropriate. | 521 // the BrowserWindow invoke WindowFullscreenStateChanged when appropriate. |
517 } | 522 } |
518 | 523 |
519 #if defined(OS_MACOSX) | 524 #if defined(OS_MACOSX) |
520 void FullscreenController::TogglePresentationModeInternal(bool for_tab) { | 525 void FullscreenController::TogglePresentationModeInternal(bool for_tab) { |
521 toggled_into_fullscreen_ = !window_->InPresentationMode(); | 526 toggled_into_fullscreen_ = !window_->InPresentationMode(); |
522 GURL url; | 527 GURL url; |
523 if (for_tab) { | 528 if (for_tab) { |
524 url = chrome::GetActiveWebContents(browser_)->GetURL(); | 529 url = chrome::GetActiveWebContents(browser_)->GetURL(); |
525 tab_fullscreen_accepted_ = toggled_into_fullscreen_ && | 530 tab_fullscreen_accepted_ = toggled_into_fullscreen_ && |
526 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; | 531 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; |
527 } | 532 } |
528 if (toggled_into_fullscreen_) | 533 if (!window_->InPresentationMode()) |
529 window_->EnterPresentationMode(url, GetFullscreenExitBubbleType()); | 534 window_->EnterPresentationMode(url, GetFullscreenExitBubbleType()); |
530 else | 535 else |
531 window_->ExitPresentationMode(); | 536 window_->ExitFullscreen(); |
532 UpdateFullscreenExitBubbleContent(); | 537 UpdateFullscreenExitBubbleContent(); |
533 | 538 |
534 // WindowFullscreenStateChanged will be called by BrowserWindowController | 539 // WindowFullscreenStateChanged will be called by BrowserWindowController |
535 // when the transition completes. | 540 // when the transition completes. |
536 } | 541 } |
537 #endif | 542 #endif |
538 | 543 |
539 void FullscreenController::SetFullscreenedTab(TabContents* tab) { | 544 void FullscreenController::SetFullscreenedTab(TabContents* tab) { |
540 fullscreened_tab_ = tab; | 545 fullscreened_tab_ = tab; |
541 UpdateNotificationRegistrations(); | 546 UpdateNotificationRegistrations(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
588 | 593 |
589 ContentSetting | 594 ContentSetting |
590 FullscreenController::GetMouseLockSetting(const GURL& url) const { | 595 FullscreenController::GetMouseLockSetting(const GURL& url) const { |
591 if (url.SchemeIsFile()) | 596 if (url.SchemeIsFile()) |
592 return CONTENT_SETTING_ALLOW; | 597 return CONTENT_SETTING_ALLOW; |
593 | 598 |
594 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); | 599 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); |
595 return settings_map->GetContentSetting(url, url, | 600 return settings_map->GetContentSetting(url, url, |
596 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); | 601 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); |
597 } | 602 } |
OLD | NEW |