| 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/exclusive_access/exclusive_access_bubble.h" | 5 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_commands.h" | 11 #include "chrome/browser/ui/browser_commands.h" |
| 12 #include "chrome/browser/ui/exclusive_access/exclusive_access_controller_manager
.h" |
| 12 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 13 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 14 #include "extensions/browser/extension_registry.h" | 15 #include "extensions/browser/extension_registry.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
| 17 #include "ui/strings/grit/ui_strings.h" | 18 #include "ui/strings/grit/ui_strings.h" |
| 18 | 19 |
| 19 // NOTE(koz): Linux doesn't use the thick shadowed border, so we add padding | 20 // NOTE(koz): Linux doesn't use the thick shadowed border, so we add padding |
| 20 // here. | 21 // here. |
| 21 #if defined(OS_LINUX) | 22 #if defined(OS_LINUX) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 CanMouseTriggerSlideIn()) { | 109 CanMouseTriggerSlideIn()) { |
| 109 Show(); | 110 Show(); |
| 110 } else if (IsAnimating()) { | 111 } else if (IsAnimating()) { |
| 111 // The cursor is not idle and either it's in the slide-in region or it's in | 112 // The cursor is not idle and either it's in the slide-in region or it's in |
| 112 // the neutral region and we're sliding in or out. | 113 // the neutral region and we're sliding in or out. |
| 113 Show(); | 114 Show(); |
| 114 } | 115 } |
| 115 } | 116 } |
| 116 | 117 |
| 117 void ExclusiveAccessBubble::ToggleFullscreen() { | 118 void ExclusiveAccessBubble::ToggleFullscreen() { |
| 118 browser_->fullscreen_controller() | 119 browser_->GetExclusiveAccessControllerManager() |
| 119 ->ExitTabOrBrowserFullscreenToPreviousState(); | 120 ->GetFullscreenController() |
| 121 ->ExitExclusiveAccessToPreviousState(); |
| 120 } | 122 } |
| 121 | 123 |
| 122 void ExclusiveAccessBubble::Accept() { | 124 void ExclusiveAccessBubble::Accept() { |
| 123 browser_->fullscreen_controller()->OnAcceptFullscreenPermission(); | 125 browser_->GetExclusiveAccessControllerManager() |
| 126 ->OnAcceptExclusiveAccessPermission(); |
| 124 } | 127 } |
| 125 | 128 |
| 126 void ExclusiveAccessBubble::Cancel() { | 129 void ExclusiveAccessBubble::Cancel() { |
| 127 browser_->fullscreen_controller()->OnDenyFullscreenPermission(); | 130 browser_->GetExclusiveAccessControllerManager() |
| 131 ->OnDenyExclusiveAccessPermission(); |
| 128 } | 132 } |
| 129 | 133 |
| 130 base::string16 ExclusiveAccessBubble::GetCurrentMessageText() const { | 134 base::string16 ExclusiveAccessBubble::GetCurrentMessageText() const { |
| 131 return exclusive_access_bubble::GetLabelTextForType( | 135 return exclusive_access_bubble::GetLabelTextForType( |
| 132 bubble_type_, url_, | 136 bubble_type_, url_, |
| 133 extensions::ExtensionRegistry::Get(browser_->profile())); | 137 extensions::ExtensionRegistry::Get(browser_->profile())); |
| 134 } | 138 } |
| 135 | 139 |
| 136 base::string16 ExclusiveAccessBubble::GetCurrentDenyButtonText() const { | 140 base::string16 ExclusiveAccessBubble::GetCurrentDenyButtonText() const { |
| 137 return exclusive_access_bubble::GetDenyButtonTextForType(bubble_type_); | 141 return exclusive_access_bubble::GetDenyButtonTextForType(bubble_type_); |
| 138 } | 142 } |
| 139 | 143 |
| 140 base::string16 ExclusiveAccessBubble::GetAllowButtonText() const { | 144 base::string16 ExclusiveAccessBubble::GetAllowButtonText() const { |
| 141 return l10n_util::GetStringUTF16(IDS_FULLSCREEN_ALLOW); | 145 return l10n_util::GetStringUTF16(IDS_FULLSCREEN_ALLOW); |
| 142 } | 146 } |
| 143 | 147 |
| 144 base::string16 ExclusiveAccessBubble::GetInstructionText() const { | 148 base::string16 ExclusiveAccessBubble::GetInstructionText() const { |
| 145 return l10n_util::GetStringFUTF16(IDS_FULLSCREEN_PRESS_ESC_TO_EXIT, | 149 return l10n_util::GetStringFUTF16(IDS_FULLSCREEN_PRESS_ESC_TO_EXIT, |
| 146 l10n_util::GetStringUTF16(IDS_APP_ESC_KEY)); | 150 l10n_util::GetStringUTF16(IDS_APP_ESC_KEY)); |
| 147 } | 151 } |
| OLD | NEW |