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" |
11 #include "chrome/browser/download/download_shelf.h" | 11 #include "chrome/browser/download/download_shelf.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_tabstrip.h" | 14 #include "chrome/browser/ui/browser_tabstrip.h" |
15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/switch_utils.h" | |
18 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
19 #include "content/public/browser/navigation_details.h" | 20 #include "content/public/browser/navigation_details.h" |
20 #include "content/public/browser/navigation_entry.h" | 21 #include "content/public/browser/navigation_entry.h" |
21 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
22 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
23 #include "content/public/browser/render_widget_host_view.h" | 24 #include "content/public/browser/render_widget_host_view.h" |
24 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
25 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
26 | 27 |
27 using content::RenderViewHost; | 28 using content::RenderViewHost; |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 else if (mouse_lock_tab_) | 380 else if (mouse_lock_tab_) |
380 return mouse_lock_tab_->GetURL(); | 381 return mouse_lock_tab_->GetURL(); |
381 else if (!extension_caused_fullscreen_.is_empty()) | 382 else if (!extension_caused_fullscreen_.is_empty()) |
382 return extension_caused_fullscreen_; | 383 return extension_caused_fullscreen_; |
383 else | 384 else |
384 return GURL(); | 385 return GURL(); |
385 } | 386 } |
386 | 387 |
387 FullscreenExitBubbleType FullscreenController::GetFullscreenExitBubbleType() | 388 FullscreenExitBubbleType FullscreenController::GetFullscreenExitBubbleType() |
388 const { | 389 const { |
389 // In kiosk mode we always want to be fullscreen and do not want to show | 390 // In kiosk and exclusive app mode we always want to be fullscreen and do not |
390 // exit instructions for browser mode fullscreen. | 391 // want to show exit instructions for browser mode fullscreen. |
391 bool kiosk = false; | 392 bool app_mode = false; |
392 #if !defined(OS_MACOSX) // Kiosk mode not available on Mac. | 393 #if !defined(OS_MACOSX) // Kiosk mode not available on Mac. |
Mr4D (OOO till 08-26)
2013/01/30 04:05:27
This comment is now a bit confusing.
zel
2013/01/30 17:06:43
Done.
| |
393 kiosk = CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); | 394 app_mode = switches::IsRunningInAppMode(); |
394 #endif | 395 #endif |
395 | 396 |
396 if (mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY) { | 397 if (mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY) { |
397 return FEB_TYPE_NONE; | 398 return FEB_TYPE_NONE; |
398 } | 399 } |
399 | 400 |
400 if (fullscreened_tab_) { | 401 if (fullscreened_tab_) { |
401 if (tab_fullscreen_accepted_) { | 402 if (tab_fullscreen_accepted_) { |
402 if (IsMouseLocked()) { | 403 if (IsMouseLocked()) { |
403 return FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION; | 404 return FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION; |
(...skipping 10 matching lines...) Expand all Loading... | |
414 } | 415 } |
415 } | 416 } |
416 } else { // Not tab full screen. | 417 } else { // Not tab full screen. |
417 if (IsMouseLocked()) { | 418 if (IsMouseLocked()) { |
418 return FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION; | 419 return FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION; |
419 } else if (IsMouseLockRequested()) { | 420 } else if (IsMouseLockRequested()) { |
420 return FEB_TYPE_MOUSELOCK_BUTTONS; | 421 return FEB_TYPE_MOUSELOCK_BUTTONS; |
421 } else { | 422 } else { |
422 if (!extension_caused_fullscreen_.is_empty()) { | 423 if (!extension_caused_fullscreen_.is_empty()) { |
423 return FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION; | 424 return FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION; |
424 } else if (toggled_into_fullscreen_ && !kiosk) { | 425 } else if (toggled_into_fullscreen_ && !app_mode) { |
425 return FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION; | 426 return FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION; |
426 } else { | 427 } else { |
427 return FEB_TYPE_NONE; | 428 return FEB_TYPE_NONE; |
428 } | 429 } |
429 } | 430 } |
430 } | 431 } |
431 NOTREACHED(); | 432 NOTREACHED(); |
432 return FEB_TYPE_NONE; | 433 return FEB_TYPE_NONE; |
433 } | 434 } |
434 | 435 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 #if defined(OS_WIN) | 498 #if defined(OS_WIN) |
498 // When in Metro snap mode, toggling in and out of fullscreen is prevented. | 499 // When in Metro snap mode, toggling in and out of fullscreen is prevented. |
499 if (IsInMetroSnapMode()) | 500 if (IsInMetroSnapMode()) |
500 return; | 501 return; |
501 #endif | 502 #endif |
502 | 503 |
503 toggled_into_fullscreen_ = !window_->IsFullscreen(); | 504 toggled_into_fullscreen_ = !window_->IsFullscreen(); |
504 | 505 |
505 // In kiosk mode, we always want to be fullscreen. When the browser first | 506 // In kiosk mode, we always want to be fullscreen. When the browser first |
506 // starts we're not yet fullscreen, so let the initial toggle go through. | 507 // starts we're not yet fullscreen, so let the initial toggle go through. |
507 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) && | 508 if (switches::IsRunningInAppMode() && !toggled_into_fullscreen_) |
508 !toggled_into_fullscreen_) | |
509 return; | 509 return; |
510 | 510 |
511 GURL url; | 511 GURL url; |
512 if (for_tab) { | 512 if (for_tab) { |
513 url = chrome::GetActiveWebContents(browser_)->GetURL(); | 513 url = chrome::GetActiveWebContents(browser_)->GetURL(); |
514 tab_fullscreen_accepted_ = toggled_into_fullscreen_ && | 514 tab_fullscreen_accepted_ = toggled_into_fullscreen_ && |
515 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; | 515 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; |
516 } else { | 516 } else { |
517 if (!extension_caused_fullscreen_.is_empty()) | 517 if (!extension_caused_fullscreen_.is_empty()) |
518 url = extension_caused_fullscreen_; | 518 url = extension_caused_fullscreen_; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
612 | 612 |
613 ContentSetting | 613 ContentSetting |
614 FullscreenController::GetMouseLockSetting(const GURL& url) const { | 614 FullscreenController::GetMouseLockSetting(const GURL& url) const { |
615 if (url.SchemeIsFile()) | 615 if (url.SchemeIsFile()) |
616 return CONTENT_SETTING_ALLOW; | 616 return CONTENT_SETTING_ALLOW; |
617 | 617 |
618 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); | 618 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); |
619 return settings_map->GetContentSetting(url, url, | 619 return settings_map->GetContentSetting(url, url, |
620 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); | 620 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); |
621 } | 621 } |
OLD | NEW |