Index: chrome/browser/ui/views/exclusive_access_bubble_views.cc |
diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc b/chrome/browser/ui/views/exclusive_access_bubble_views.cc |
similarity index 84% |
rename from chrome/browser/ui/views/fullscreen_exit_bubble_views.cc |
rename to chrome/browser/ui/views/exclusive_access_bubble_views.cc |
index 9545d1ae45ed7d14fb61aea9494cce5142bc5c43..9b5235d5adbc248cb5e53df4b3eb4e4f67a02182 100644 |
--- a/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc |
+++ b/chrome/browser/ui/views/exclusive_access_bubble_views.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" |
+#include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
#include "base/message_loop/message_loop.h" |
#include "base/strings/utf_string_conversions.h" |
@@ -35,7 +35,7 @@ |
#include "ui/base/l10n/l10n_util_win.h" |
#endif |
-// FullscreenExitView ---------------------------------------------------------- |
+// ExclusiveAccessView --------------------------------------------------------- |
namespace { |
@@ -87,16 +87,16 @@ gfx::Size ButtonView::GetPreferredSize() const { |
} // namespace |
-class FullscreenExitBubbleViews::FullscreenExitView |
+class ExclusiveAccessBubbleViews::ExclusiveAccessView |
: public views::View, |
public views::ButtonListener, |
public views::LinkListener { |
public: |
- FullscreenExitView(FullscreenExitBubbleViews* bubble, |
+ ExclusiveAccessView(ExclusiveAccessBubbleViews* bubble, |
const base::string16& accelerator, |
const GURL& url, |
- FullscreenExitBubbleType bubble_type); |
- ~FullscreenExitView() override; |
+ ExclusiveAccessBubbleType bubble_type); |
+ ~ExclusiveAccessView() override; |
// views::ButtonListener |
void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
@@ -104,10 +104,10 @@ class FullscreenExitBubbleViews::FullscreenExitView |
// views::LinkListener |
void LinkClicked(views::Link* source, int event_flags) override; |
- void UpdateContent(const GURL& url, FullscreenExitBubbleType bubble_type); |
+ void UpdateContent(const GURL& url, ExclusiveAccessBubbleType bubble_type); |
private: |
- FullscreenExitBubbleViews* bubble_; |
+ ExclusiveAccessBubbleViews* bubble_; |
// Clickable hint text for exiting fullscreen mode. |
views::Link* link_; |
@@ -118,14 +118,14 @@ class FullscreenExitBubbleViews::FullscreenExitView |
ButtonView* button_view_; |
const base::string16 browser_fullscreen_exit_accelerator_; |
- DISALLOW_COPY_AND_ASSIGN(FullscreenExitView); |
+ DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessView); |
}; |
-FullscreenExitBubbleViews::FullscreenExitView::FullscreenExitView( |
- FullscreenExitBubbleViews* bubble, |
+ExclusiveAccessBubbleViews::ExclusiveAccessView::ExclusiveAccessView( |
+ ExclusiveAccessBubbleViews* bubble, |
const base::string16& accelerator, |
const GURL& url, |
- FullscreenExitBubbleType bubble_type) |
+ ExclusiveAccessBubbleType bubble_type) |
: bubble_(bubble), |
link_(NULL), |
mouse_lock_exit_instruction_(NULL), |
@@ -195,10 +195,10 @@ FullscreenExitBubbleViews::FullscreenExitView::FullscreenExitView( |
UpdateContent(url, bubble_type); |
} |
-FullscreenExitBubbleViews::FullscreenExitView::~FullscreenExitView() { |
+ExclusiveAccessBubbleViews::ExclusiveAccessView::~ExclusiveAccessView() { |
} |
-void FullscreenExitBubbleViews::FullscreenExitView::ButtonPressed( |
+void ExclusiveAccessBubbleViews::ExclusiveAccessView::ButtonPressed( |
views::Button* sender, |
const ui::Event& event) { |
if (sender == button_view_->accept_button()) |
@@ -207,19 +207,19 @@ void FullscreenExitBubbleViews::FullscreenExitView::ButtonPressed( |
bubble_->Cancel(); |
} |
-void FullscreenExitBubbleViews::FullscreenExitView::LinkClicked( |
+void ExclusiveAccessBubbleViews::ExclusiveAccessView::LinkClicked( |
views::Link* link, |
int event_flags) { |
bubble_->ToggleFullscreen(); |
} |
-void FullscreenExitBubbleViews::FullscreenExitView::UpdateContent( |
+void ExclusiveAccessBubbleViews::ExclusiveAccessView::UpdateContent( |
const GURL& url, |
- FullscreenExitBubbleType bubble_type) { |
- DCHECK_NE(FEB_TYPE_NONE, bubble_type); |
+ ExclusiveAccessBubbleType bubble_type) { |
+ DCHECK_NE(EAB_TYPE_NONE, bubble_type); |
message_label_->SetText(bubble_->GetCurrentMessageText()); |
- if (fullscreen_bubble::ShowButtonsForType(bubble_type)) { |
+ if (exclusive_access_bubble::ShowButtonsForType(bubble_type)) { |
link_->SetVisible(false); |
mouse_lock_exit_instruction_->SetVisible(false); |
button_view_->SetVisible(true); |
@@ -228,10 +228,10 @@ void FullscreenExitBubbleViews::FullscreenExitView::UpdateContent( |
} else { |
bool link_visible = true; |
base::string16 accelerator; |
- if (bubble_type == FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION || |
- bubble_type == FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION) { |
+ if (bubble_type == EAB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION || |
+ bubble_type == EAB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION) { |
accelerator = browser_fullscreen_exit_accelerator_; |
- } else if (bubble_type == FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION) { |
+ } else if (bubble_type == EAB_TYPE_FULLSCREEN_EXIT_INSTRUCTION) { |
accelerator = l10n_util::GetStringUTF16(IDS_APP_ESC_KEY); |
} else { |
link_visible = false; |
@@ -252,13 +252,13 @@ void FullscreenExitBubbleViews::FullscreenExitView::UpdateContent( |
} |
-// FullscreenExitBubbleViews --------------------------------------------------- |
+// ExclusiveAccessBubbleViews -------------------------------------------------- |
-FullscreenExitBubbleViews::FullscreenExitBubbleViews( |
+ExclusiveAccessBubbleViews::ExclusiveAccessBubbleViews( |
BrowserView* browser_view, |
const GURL& url, |
- FullscreenExitBubbleType bubble_type) |
- : FullscreenExitBubble(browser_view->browser(), url, bubble_type), |
+ ExclusiveAccessBubbleType bubble_type) |
+ : ExclusiveAccessBubble(browser_view->browser(), url, bubble_type), |
browser_view_(browser_view), |
popup_(NULL), |
animation_(new gfx::SlideAnimation(this)), |
@@ -270,7 +270,7 @@ FullscreenExitBubbleViews::FullscreenExitBubbleViews( |
bool got_accelerator = browser_view_->GetWidget()->GetAccelerator( |
IDC_FULLSCREEN, &accelerator); |
DCHECK(got_accelerator); |
- view_ = new FullscreenExitView( |
+ view_ = new ExclusiveAccessView( |
this, accelerator.GetShortcutText(), url, bubble_type_); |
// TODO(yzshen): Change to use the new views bubble, BubbleDelegateView. |
@@ -305,7 +305,7 @@ FullscreenExitBubbleViews::FullscreenExitBubbleViews( |
UpdateForImmersiveState(); |
} |
-FullscreenExitBubbleViews::~FullscreenExitBubbleViews() { |
+ExclusiveAccessBubbleViews::~ExclusiveAccessBubbleViews() { |
popup_->RemoveObserver(this); |
// This is tricky. We may be in an ATL message handler stack, in which case |
@@ -321,10 +321,10 @@ FullscreenExitBubbleViews::~FullscreenExitBubbleViews() { |
base::MessageLoop::current()->DeleteSoon(FROM_HERE, popup_); |
} |
-void FullscreenExitBubbleViews::UpdateContent( |
+void ExclusiveAccessBubbleViews::UpdateContent( |
const GURL& url, |
- FullscreenExitBubbleType bubble_type) { |
- DCHECK_NE(FEB_TYPE_NONE, bubble_type); |
+ ExclusiveAccessBubbleType bubble_type) { |
+ DCHECK_NE(EAB_TYPE_NONE, bubble_type); |
if (bubble_type_ == bubble_type && url_ == url) |
return; |
@@ -345,15 +345,16 @@ void FullscreenExitBubbleViews::UpdateContent( |
UpdateMouseWatcher(); |
} |
-void FullscreenExitBubbleViews::RepositionIfVisible() { |
+void ExclusiveAccessBubbleViews::RepositionIfVisible() { |
if (popup_->IsVisible()) |
UpdateBounds(); |
} |
-void FullscreenExitBubbleViews::UpdateMouseWatcher() { |
+void ExclusiveAccessBubbleViews::UpdateMouseWatcher() { |
bool should_watch_mouse = false; |
if (popup_->IsVisible()) |
- should_watch_mouse = !fullscreen_bubble::ShowButtonsForType(bubble_type_); |
+ should_watch_mouse = !exclusive_access_bubble::ShowButtonsForType( |
+ bubble_type_); |
else |
should_watch_mouse = CanMouseTriggerSlideIn(); |
@@ -366,7 +367,7 @@ void FullscreenExitBubbleViews::UpdateMouseWatcher() { |
StopWatchingMouse(); |
} |
-void FullscreenExitBubbleViews::UpdateForImmersiveState() { |
+void ExclusiveAccessBubbleViews::UpdateForImmersiveState() { |
AnimatedAttribute expected_animated_attribute = |
browser_view_->immersive_mode_controller()->IsEnabled() ? |
ANIMATED_ATTRIBUTE_OPACITY : ANIMATED_ATTRIBUTE_BOUNDS; |
@@ -390,7 +391,7 @@ void FullscreenExitBubbleViews::UpdateForImmersiveState() { |
UpdateMouseWatcher(); |
} |
-void FullscreenExitBubbleViews::UpdateBounds() { |
+void ExclusiveAccessBubbleViews::UpdateBounds() { |
gfx::Rect popup_rect(GetPopupRect(false)); |
if (!popup_rect.IsEmpty()) { |
popup_->SetBounds(popup_rect); |
@@ -398,11 +399,11 @@ void FullscreenExitBubbleViews::UpdateBounds() { |
} |
} |
-views::View* FullscreenExitBubbleViews::GetBrowserRootView() const { |
+views::View* ExclusiveAccessBubbleViews::GetBrowserRootView() const { |
return browser_view_->GetWidget()->GetRootView(); |
} |
-void FullscreenExitBubbleViews::AnimationProgressed( |
+void ExclusiveAccessBubbleViews::AnimationProgressed( |
const gfx::Animation* animation) { |
if (animated_attribute_ == ANIMATED_ATTRIBUTE_OPACITY) { |
int opacity = animation_->CurrentValueBetween(0, 255); |
@@ -422,12 +423,12 @@ void FullscreenExitBubbleViews::AnimationProgressed( |
} |
} |
-void FullscreenExitBubbleViews::AnimationEnded( |
+void ExclusiveAccessBubbleViews::AnimationEnded( |
const gfx::Animation* animation) { |
AnimationProgressed(animation); |
} |
-gfx::Rect FullscreenExitBubbleViews::GetPopupRect( |
+gfx::Rect ExclusiveAccessBubbleViews::GetPopupRect( |
bool ignore_animation_state) const { |
gfx::Size size(view_->GetPreferredSize()); |
// NOTE: don't use the bounds of the root_view_. On linux GTK changing window |
@@ -465,40 +466,40 @@ gfx::Rect FullscreenExitBubbleViews::GetPopupRect( |
return gfx::Rect(gfx::Point(x, y), size); |
} |
-gfx::Point FullscreenExitBubbleViews::GetCursorScreenPoint() { |
+gfx::Point ExclusiveAccessBubbleViews::GetCursorScreenPoint() { |
gfx::Point cursor_pos = gfx::Screen::GetScreenFor( |
browser_view_->GetWidget()->GetNativeView())->GetCursorScreenPoint(); |
views::View::ConvertPointFromScreen(GetBrowserRootView(), &cursor_pos); |
return cursor_pos; |
} |
-bool FullscreenExitBubbleViews::WindowContainsPoint(gfx::Point pos) { |
+bool ExclusiveAccessBubbleViews::WindowContainsPoint(gfx::Point pos) { |
return GetBrowserRootView()->HitTestPoint(pos); |
} |
-bool FullscreenExitBubbleViews::IsWindowActive() { |
+bool ExclusiveAccessBubbleViews::IsWindowActive() { |
return browser_view_->GetWidget()->IsActive(); |
} |
-void FullscreenExitBubbleViews::Hide() { |
+void ExclusiveAccessBubbleViews::Hide() { |
animation_->SetSlideDuration(kSlideOutDurationMs); |
animation_->Hide(); |
} |
-void FullscreenExitBubbleViews::Show() { |
+void ExclusiveAccessBubbleViews::Show() { |
animation_->SetSlideDuration(kSlideInDurationMs); |
animation_->Show(); |
} |
-bool FullscreenExitBubbleViews::IsAnimating() { |
+bool ExclusiveAccessBubbleViews::IsAnimating() { |
return animation_->is_animating(); |
} |
-bool FullscreenExitBubbleViews::CanMouseTriggerSlideIn() const { |
+bool ExclusiveAccessBubbleViews::CanMouseTriggerSlideIn() const { |
return !browser_view_->immersive_mode_controller()->IsEnabled(); |
} |
-void FullscreenExitBubbleViews::Observe( |
+void ExclusiveAccessBubbleViews::Observe( |
int type, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) { |
@@ -506,7 +507,7 @@ void FullscreenExitBubbleViews::Observe( |
UpdateForImmersiveState(); |
} |
-void FullscreenExitBubbleViews::OnWidgetVisibilityChanged( |
+void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( |
views::Widget* widget, |
bool visible) { |
UpdateMouseWatcher(); |