summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-02 04:16:59 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-02 04:16:59 +0000
commitf0be863af2b9e997e7ebb025fda1105f6560e765 (patch)
treefbbaf35a1709ef285912eb3942e5d2156bef2765
parent37950fc7524f7c5ca2316494cd3e324e9f21a2df (diff)
downloadchromium_src-f0be863af2b9e997e7ebb025fda1105f6560e765.zip
chromium_src-f0be863af2b9e997e7ebb025fda1105f6560e765.tar.gz
chromium_src-f0be863af2b9e997e7ebb025fda1105f6560e765.tar.bz2
Remove the old views bubble code.
Bubbles previously using this code now use ui/views/bubble. This code is now dead and can be removed; yay! BUG=97248,98312,98322,98323 TEST=none Review URL: http://codereview.chromium.org/8761012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112633 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/bubble/border_contents.cc24
-rw-r--r--chrome/browser/ui/views/bubble/border_contents.h27
-rw-r--r--chrome/browser/ui/views/bubble/border_widget_win.cc55
-rw-r--r--chrome/browser/ui/views/bubble/border_widget_win.h53
-rw-r--r--chrome/browser/ui/views/bubble/bubble.cc442
-rw-r--r--chrome/browser/ui/views/bubble/bubble.h269
-rw-r--r--chrome/chrome_browser.gypi12
7 files changed, 0 insertions, 882 deletions
diff --git a/chrome/browser/ui/views/bubble/border_contents.cc b/chrome/browser/ui/views/bubble/border_contents.cc
deleted file mode 100644
index c5d025e..0000000
--- a/chrome/browser/ui/views/bubble/border_contents.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// 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/bubble/border_contents.h"
-
-#include "chrome/browser/ui/window_sizer.h"
-
-static const int kTopMargin = 6;
-static const int kLeftMargin = 6;
-static const int kBottomMargin = 9;
-static const int kRightMargin = 6;
-
-BorderContents::BorderContents()
- : BorderContentsView(kTopMargin,
- kLeftMargin,
- kBottomMargin,
- kRightMargin) {}
-
-gfx::Rect BorderContents::GetMonitorBounds(const gfx::Rect& rect) {
- scoped_ptr<WindowSizer::MonitorInfoProvider> monitor_provider(
- WindowSizer::CreateDefaultMonitorInfoProvider());
- return monitor_provider->GetMonitorWorkAreaMatching(rect);
-}
diff --git a/chrome/browser/ui/views/bubble/border_contents.h b/chrome/browser/ui/views/bubble/border_contents.h
deleted file mode 100644
index 83db0a2..0000000
--- a/chrome/browser/ui/views/bubble/border_contents.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_CONTENTS_H_
-#define CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_CONTENTS_H_
-#pragma once
-
-#include "ui/views/bubble/border_contents_view.h"
-
-// This is used to paint the border of the Bubble. Windows uses this via
-// BorderWidgetWin, while others can use it directly in the bubble.
-class BorderContents : public views::BorderContentsView {
- public:
- BorderContents();
-
- protected:
- virtual ~BorderContents() { }
-
- // views::BorderContentsView overrides:
- virtual gfx::Rect GetMonitorBounds(const gfx::Rect& rect) OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(BorderContents);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_CONTENTS_H_
diff --git a/chrome/browser/ui/views/bubble/border_widget_win.cc b/chrome/browser/ui/views/bubble/border_widget_win.cc
deleted file mode 100644
index 1a5be37..0000000
--- a/chrome/browser/ui/views/bubble/border_widget_win.cc
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// 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/bubble/border_widget_win.h"
-
-#include <windows.h>
-
-#include "chrome/browser/ui/views/bubble/border_contents.h"
-#include "ui/views/widget/widget.h"
-
-BorderWidgetWin::BorderWidgetWin()
- : views::NativeWidgetWin(new views::Widget),
- border_contents_(NULL) {
-}
-
-void BorderWidgetWin::InitBorderWidgetWin(BorderContents* border_contents,
- HWND owner) {
- DCHECK(!border_contents_);
- border_contents_ = border_contents;
- border_contents_->Init();
-
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
- params.transparent = true;
- params.parent = owner;
- params.native_widget = this;
- GetWidget()->Init(params);
- GetWidget()->SetContentsView(border_contents_);
- SetWindowPos(owner, 0, 0, 0, 0,
- SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOREDRAW);
-}
-
-gfx::Rect BorderWidgetWin::SizeAndGetBounds(
- const gfx::Rect& position_relative_to,
- views::BubbleBorder::ArrowLocation arrow_location,
- const gfx::Size& contents_size) {
- // Ask the border view to calculate our bounds (and our contents').
- gfx::Rect contents_bounds;
- gfx::Rect window_bounds;
- border_contents_->SizeAndGetBounds(position_relative_to, arrow_location,
- false, contents_size, &contents_bounds,
- &window_bounds);
- GetWidget()->SetBounds(window_bounds);
-
- // Return |contents_bounds| in screen coordinates.
- contents_bounds.Offset(window_bounds.origin());
- return contents_bounds;
-}
-
-LRESULT BorderWidgetWin::OnMouseActivate(UINT message,
- WPARAM w_param,
- LPARAM l_param) {
- // Never activate.
- return MA_NOACTIVATE;
-}
diff --git a/chrome/browser/ui/views/bubble/border_widget_win.h b/chrome/browser/ui/views/bubble/border_widget_win.h
deleted file mode 100644
index 9179d67..0000000
--- a/chrome/browser/ui/views/bubble/border_widget_win.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_WIDGET_WIN_H_
-#define CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_WIDGET_WIN_H_
-#pragma once
-
-#include "ui/views/bubble/bubble_border.h"
-#include "ui/views/widget/native_widget_win.h"
-
-class BorderContents;
-
-// This is a window that surrounds the info bubble and paints the margin and
-// border. It is a separate window so that it can be a layered window, so that
-// we can use >1-bit alpha shadow images on the borders, which look nicer than
-// the Windows CS_DROPSHADOW shadows. The info bubble window itself cannot be a
-// layered window because that prevents it from hosting native child controls.
-class BorderWidgetWin : public views::NativeWidgetWin {
- public:
- BorderWidgetWin();
- virtual ~BorderWidgetWin() { }
-
- // Initializes the BrowserWidget making |owner| its owning window.
- void InitBorderWidgetWin(BorderContents* border_contents, HWND owner);
-
- // Given the size of the contained contents (without margins), and the rect
- // (in screen coordinates) to point to, sets the border window positions and
- // sizes the border window and returns the bounds (in screen coordinates) the
- // contents should use. |arrow_location| is prefered arrow location,
- // the function tries to preserve the location and direction, in case of RTL
- // arrow location is mirrored.
- virtual gfx::Rect SizeAndGetBounds(
- const gfx::Rect& position_relative_to,
- views::BubbleBorder::ArrowLocation arrow_location,
- const gfx::Size& contents_size);
-
- // Simple accessors.
- BorderContents* border_contents() { return border_contents_; }
-
- protected:
- BorderContents* border_contents_;
-
- private:
- // Overridden from NativeWidgetWin:
- virtual LRESULT OnMouseActivate(UINT message,
- WPARAM w_param,
- LPARAM l_param) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(BorderWidgetWin);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_WIDGET_WIN_H_
diff --git a/chrome/browser/ui/views/bubble/bubble.cc b/chrome/browser/ui/views/bubble/bubble.cc
deleted file mode 100644
index 6cf7d22..0000000
--- a/chrome/browser/ui/views/bubble/bubble.cc
+++ /dev/null
@@ -1,442 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// 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/bubble/bubble.h"
-
-#include <vector>
-
-#include "chrome/browser/ui/views/bubble/border_contents.h"
-#include "chrome/common/chrome_notification_types.h"
-#include "ui/base/animation/slide_animation.h"
-#include "ui/base/keycodes/keyboard_codes.h"
-#include "ui/gfx/color_utils.h"
-#include "ui/views/layout/fill_layout.h"
-#include "ui/views/widget/widget.h"
-#include "ui/views/window/client_view.h"
-
-#if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK)
-#include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h"
-#include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h"
-#endif
-
-#if defined(OS_WIN) && !defined(USE_AURA)
-#include "chrome/browser/ui/views/bubble/border_widget_win.h"
-#endif
-
-using std::vector;
-
-// How long the fade should last for.
-static const int kHideFadeDurationMS = 200;
-
-// Background color of the bubble.
-#if defined(OS_WIN) && !defined(USE_AURA)
-const SkColor Bubble::kBackgroundColor =
- color_utils::GetSysSkColor(COLOR_WINDOW);
-#else
-// TODO(beng): source from theme provider.
-const SkColor Bubble::kBackgroundColor = SK_ColorWHITE;
-#endif
-
-// BubbleDelegate ---------------------------------------------------------
-
-string16 BubbleDelegate::GetAccessibleName() {
- return string16();
-}
-
-// Bubble -----------------------------------------------------------------
-
-// static
-Bubble* Bubble::Show(views::Widget* parent,
- const gfx::Rect& position_relative_to,
- views::BubbleBorder::ArrowLocation arrow_location,
- views::BubbleBorder::BubbleAlignment alignment,
- views::View* contents,
- BubbleDelegate* delegate) {
- Bubble* bubble = new Bubble;
- bubble->InitBubble(parent, position_relative_to, arrow_location, alignment,
- contents, delegate);
-
- // Register the Escape accelerator for closing.
- bubble->RegisterEscapeAccelerator();
-
- if (delegate)
- delegate->BubbleShown();
-
- return bubble;
-}
-
-#if defined(OS_CHROMEOS)
-// static
-Bubble* Bubble::ShowFocusless(
- views::Widget* parent,
- const gfx::Rect& position_relative_to,
- views::BubbleBorder::ArrowLocation arrow_location,
- views::BubbleBorder::BubbleAlignment alignment,
- views::View* contents,
- BubbleDelegate* delegate,
- bool show_while_screen_is_locked) {
- Bubble* bubble = new Bubble(views::Widget::InitParams::TYPE_POPUP,
- show_while_screen_is_locked);
- bubble->InitBubble(parent, position_relative_to, arrow_location, alignment,
- contents, delegate);
- return bubble;
-}
-#endif
-
-void Bubble::Close() {
- if (show_status_ != kOpen)
- return;
-
- show_status_ = kClosing;
-
- if (fade_away_on_close_)
- FadeOut();
- else
- DoClose(false);
-}
-
-void Bubble::AnimationEnded(const ui::Animation* animation) {
- if (static_cast<int>(animation_->GetCurrentValue()) == 0) {
- // When fading out we just need to close the bubble at the end
- DoClose(false);
- } else {
-#if defined(OS_WIN) && !defined(USE_AURA)
- // When fading in we need to remove the layered window style flag, since
- // that style prevents some bubble content from working properly.
- SetWindowLong(GWL_EXSTYLE, GetWindowLong(GWL_EXSTYLE) & ~WS_EX_LAYERED);
-#endif
- }
-}
-
-void Bubble::AnimationProgressed(const ui::Animation* animation) {
- // Set the opacity for the main contents window.
- unsigned char opacity = static_cast<unsigned char>(
- animation_->GetCurrentValue() * 255);
-#if defined(OS_WIN) && !defined(USE_AURA)
- SetLayeredWindowAttributes(GetNativeView(), 0,
- static_cast<byte>(opacity), LWA_ALPHA);
- contents_->SchedulePaint();
-
- // Also fade in/out the bubble border window.
- border_->SetOpacity(opacity);
- border_->border_contents()->SchedulePaint();
-#else
- SetOpacity(opacity);
- border_contents_->SchedulePaint();
-#endif
-}
-
-Bubble::Bubble()
- :
-#if defined(USE_AURA)
- views::NativeWidgetAura(new views::Widget),
-#elif defined(OS_WIN)
- views::NativeWidgetWin(new views::Widget),
-#elif defined(TOOLKIT_USES_GTK)
- views::NativeWidgetGtk(new views::Widget),
-#endif
-#if defined(OS_WIN) && !defined(USE_AURA)
- border_(NULL),
-#else
- border_contents_(NULL),
-#endif
- delegate_(NULL),
- show_status_(kOpen),
- fade_away_on_close_(false),
- close_on_deactivate_(true),
-#if defined(TOOLKIT_USES_GTK)
- type_(views::Widget::InitParams::TYPE_WINDOW_FRAMELESS),
-#endif
-#if defined(OS_CHROMEOS)
- show_while_screen_is_locked_(false),
-#endif
- arrow_location_(views::BubbleBorder::NONE),
- contents_(NULL),
- accelerator_registered_(false) {
-}
-
-#if defined(OS_CHROMEOS)
-Bubble::Bubble(views::Widget::InitParams::Type type,
- bool show_while_screen_is_locked)
-#if defined(USE_AURA)
- : views::NativeWidgetAura(new views::Widget),
-#else
- : views::NativeWidgetGtk(new views::Widget),
-#endif
- border_contents_(NULL),
- delegate_(NULL),
- show_status_(kOpen),
- fade_away_on_close_(false),
-#if defined(TOOLKIT_USES_GTK)
- type_(type),
-#endif
- show_while_screen_is_locked_(show_while_screen_is_locked),
- arrow_location_(views::BubbleBorder::NONE),
- contents_(NULL),
- accelerator_registered_(false) {
-}
-#endif
-
-Bubble::~Bubble() {
-}
-
-void Bubble::InitBubble(views::Widget* parent,
- const gfx::Rect& position_relative_to,
- views::BubbleBorder::ArrowLocation arrow_location,
- views::BubbleBorder::BubbleAlignment alignment,
- views::View* contents,
- BubbleDelegate* delegate) {
- delegate_ = delegate;
- position_relative_to_ = position_relative_to;
- arrow_location_ = arrow_location;
- contents_ = contents;
- const bool fade_in = delegate_ && delegate_->FadeInOnShow();
-
- // Create the main window.
-#if defined(USE_AURA)
- views::Widget* parent_window = parent->GetTopLevelWidget();
- if (parent_window)
- parent_window->DisableInactiveRendering();
- views::Widget::InitParams params;
- params.transparent = true;
- params.parent_widget = parent;
- params.native_widget = this;
- GetWidget()->Init(params);
- if (fade_in)
- SetOpacity(0);
-#elif defined(OS_WIN)
- views::Widget* parent_window = parent->GetTopLevelWidget();
- if (parent_window)
- parent_window->DisableInactiveRendering();
- set_window_style(WS_POPUP | WS_CLIPCHILDREN);
- int extended_style = WS_EX_TOOLWINDOW;
- // During FadeIn we need to turn on the layered window style to deal with
- // transparency. This flag needs to be reset after fading in is complete.
- if (fade_in)
- extended_style |= WS_EX_LAYERED;
- set_window_ex_style(extended_style);
-
- DCHECK(!border_);
- border_ = new BorderWidgetWin();
-
- border_->InitBorderWidgetWin(CreateBorderContents(), parent->GetNativeView());
- border_->border_contents()->SetBackgroundColor(kBackgroundColor);
- border_->border_contents()->SetAlignment(alignment);
-
- // We make the BorderWidgetWin the owner of the Bubble HWND, so that the
- // latter is displayed on top of the former.
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
- params.parent = border_->GetNativeView();
- params.native_widget = this;
- GetWidget()->Init(params);
-
- if (fade_in) {
- border_->SetOpacity(0);
- GetWidget()->SetOpacity(0);
- }
- SetWindowText(GetNativeView(), delegate_->GetAccessibleName().c_str());
-#elif defined(TOOLKIT_USES_GTK)
- views::Widget::InitParams params(type_);
- params.transparent = true;
- params.parent_widget = parent;
- params.native_widget = this;
- GetWidget()->Init(params);
- if (fade_in)
- SetOpacity(0);
-#if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK)
- {
- vector<int> params;
- params.push_back(show_while_screen_is_locked_ ? 1 : 0);
- chromeos::WmIpc::instance()->SetWindowType(
- GetNativeView(),
- chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE,
- &params);
- }
-#endif
-#endif
-
- // Create a View to hold the contents of the main window.
- views::View* contents_view = new views::View;
- // We add |contents_view| to ourselves before the AddChildView() call below so
- // that when |contents| gets added, it will already have a widget, and thus
- // any NativeButtons it creates in ViewHierarchyChanged() will be functional
- // (e.g. calling SetChecked() on checkboxes is safe).
- GetWidget()->SetContentsView(contents_view);
- // Adding |contents| as a child has to be done before we call
- // contents->GetPreferredSize() below, since some supplied views don't
- // actually initialize themselves until they're added to a hierarchy.
- contents_view->AddChildView(contents);
-
- // Calculate and set the bounds for all windows and views.
- gfx::Rect window_bounds;
-
-#if defined(OS_WIN) && !defined(USE_AURA)
- // Initialize and position the border window.
- window_bounds = border_->SizeAndGetBounds(position_relative_to,
- arrow_location,
- contents->GetPreferredSize());
-
- // Make |contents| take up the entire contents view.
- contents_view->SetLayoutManager(new views::FillLayout);
-
- // Paint the background color behind the contents.
- contents_view->set_background(
- views::Background::CreateSolidBackground(kBackgroundColor));
-#else
- // Create a view to paint the border and background.
- border_contents_ = CreateBorderContents();
- border_contents_->Init();
- border_contents_->SetBackgroundColor(kBackgroundColor);
- border_contents_->SetAlignment(alignment);
- gfx::Rect contents_bounds;
- border_contents_->SizeAndGetBounds(position_relative_to,
- arrow_location, false, contents->GetPreferredSize(),
- &contents_bounds, &window_bounds);
- // This new view must be added before |contents| so it will paint under it.
- contents_view->AddChildViewAt(border_contents_, 0);
-
- // |contents_view| has no layout manager, so we have to explicitly position
- // its children.
- border_contents_->SetBoundsRect(
- gfx::Rect(gfx::Point(), window_bounds.size()));
- contents->SetBoundsRect(contents_bounds);
-#endif
- GetWidget()->SetBounds(window_bounds);
-
- // Show the window.
-#if defined(USE_AURA)
- GetWidget()->Show();
-#elif defined(OS_WIN)
- border_->ShowWindow(SW_SHOW);
- ShowWindow(SW_SHOW);
-#elif defined(TOOLKIT_USES_GTK)
- GetWidget()->Show();
-#endif
-
- if (fade_in)
- FadeIn();
-}
-
-void Bubble::RegisterEscapeAccelerator() {
- GetWidget()->GetFocusManager()->RegisterAccelerator(
- ui::Accelerator(ui::VKEY_ESCAPE, false, false, false), this);
- accelerator_registered_ = true;
-}
-
-void Bubble::UnregisterEscapeAccelerator() {
- DCHECK(accelerator_registered_);
- GetWidget()->GetFocusManager()->UnregisterAccelerator(
- ui::Accelerator(ui::VKEY_ESCAPE, false, false, false), this);
- accelerator_registered_ = false;
-}
-
-BorderContents* Bubble::CreateBorderContents() {
- return new BorderContents();
-}
-
-void Bubble::SizeToContents() {
- gfx::Rect window_bounds;
-
-#if defined(OS_WIN) && !defined(USE_AURA)
- // Initialize and position the border window.
- window_bounds = border_->SizeAndGetBounds(position_relative_to_,
- arrow_location_,
- contents_->GetPreferredSize());
-#else
- gfx::Rect contents_bounds;
- border_contents_->SizeAndGetBounds(position_relative_to_,
- arrow_location_, false, contents_->GetPreferredSize(),
- &contents_bounds, &window_bounds);
- // |contents_view| has no layout manager, so we have to explicitly position
- // its children.
- border_contents_->SetBoundsRect(
- gfx::Rect(gfx::Point(), window_bounds.size()));
- contents_->SetBoundsRect(contents_bounds);
-#endif
- GetWidget()->SetBounds(window_bounds);
-}
-
-#if defined(USE_AURA)
-void Bubble::OnLostActive() {
- GetWidget()->Close();
-}
-#elif defined(OS_WIN)
-void Bubble::OnActivate(UINT action, BOOL minimized, HWND window) {
- // The popup should close when it is deactivated.
- if (action == WA_INACTIVE) {
- if (close_on_deactivate_)
- GetWidget()->Close();
- } else if (action == WA_ACTIVE) {
- DCHECK(GetWidget()->GetRootView()->has_children());
- GetWidget()->GetRootView()->child_at(0)->RequestFocus();
- }
-}
-#elif defined(TOOLKIT_USES_GTK)
-void Bubble::OnActiveChanged() {
- if (!GetWidget()->IsActive())
- GetWidget()->Close();
-}
-#endif
-
-void Bubble::DoClose(bool closed_by_escape) {
- if (show_status_ == kClosed)
- return;
-
- if (accelerator_registered_)
- UnregisterEscapeAccelerator();
- if (delegate_)
- delegate_->BubbleClosing(this, closed_by_escape);
- FOR_EACH_OBSERVER(Observer, observer_list_, OnBubbleClosing());
- show_status_ = kClosed;
-#if defined(OS_WIN) && !defined(USE_AURA)
- border_->Close();
-#endif
-#if defined(USE_AURA)
- NativeWidgetAura::Close();
-#elif defined(OS_WIN)
- NativeWidgetWin::Close();
-#elif defined(TOOLKIT_USES_GTK)
- NativeWidgetGtk::Close();
-#endif
-}
-
-void Bubble::FadeIn() {
- Fade(true); // |fade_in|.
-}
-
-void Bubble::FadeOut() {
-#if defined(OS_WIN) && !defined(USE_AURA)
- // The contents window cannot have the layered flag on by default, since its
- // content doesn't always work inside a layered window, but when animating it
- // is ok to set that style on the window for the purpose of fading it out.
- SetWindowLong(GWL_EXSTYLE, GetWindowLong(GWL_EXSTYLE) | WS_EX_LAYERED);
- // This must be the very next call, otherwise we can get flicker on close.
- SetLayeredWindowAttributes(GetNativeView(), 0,
- static_cast<byte>(255), LWA_ALPHA);
-#elif defined(USE_AURA)
- NOTIMPLEMENTED();
-#endif
-
- Fade(false); // |fade_in|.
-}
-
-void Bubble::Fade(bool fade_in) {
- animation_.reset(new ui::SlideAnimation(this));
- animation_->SetSlideDuration(kHideFadeDurationMS);
- animation_->SetTweenType(ui::Tween::LINEAR);
-
- animation_->Reset(fade_in ? 0.0 : 1.0);
- if (fade_in)
- animation_->Show();
- else
- animation_->Hide();
-}
-
-bool Bubble::AcceleratorPressed(const ui::Accelerator& accelerator) {
- if (!delegate_ || delegate_->CloseOnEscape()) {
- DoClose(true);
- return true;
- }
- return false;
-}
diff --git a/chrome/browser/ui/views/bubble/bubble.h b/chrome/browser/ui/views/bubble/bubble.h
deleted file mode 100644
index edbd745..0000000
--- a/chrome/browser/ui/views/bubble/bubble.h
+++ /dev/null
@@ -1,269 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_BUBBLE_BUBBLE_H_
-#define CHROME_BROWSER_UI_VIEWS_BUBBLE_BUBBLE_H_
-#pragma once
-
-#include "base/compiler_specific.h"
-#include "base/observer_list.h"
-#include "ui/base/accelerators/accelerator.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/views/bubble/bubble_border.h"
-#include "ui/views/view.h"
-
-#if defined(USE_AURA)
-#include "ui/views/widget/native_widget_aura.h"
-#elif defined(OS_WIN)
-#include "ui/views/widget/native_widget_win.h"
-#elif defined(TOOLKIT_USES_GTK)
-#include "ui/views/widget/native_widget_gtk.h"
-#endif
-
-// Bubble is used to display an arbitrary view above all other windows.
-// Think of Bubble as a tooltip that allows you to embed an arbitrary view
-// in the tooltip. Additionally the Bubble renders an arrow pointing at
-// the region the info bubble is providing the information about.
-//
-// To use an Bubble, invoke Show() and it'll take care of the rest. The Bubble
-// insets the contents for you, so the contents typically shouldn't have any
-// additional margins.
-
-class BorderContents;
-#if defined(OS_WIN) && !defined(USE_AURA)
-class BorderWidgetWin;
-#endif
-class Bubble;
-
-namespace ui {
-class SlideAnimation;
-}
-
-namespace views {
-class Widget;
-}
-
-class BubbleDelegate {
- public:
- // Called after the Bubble has been shown.
- virtual void BubbleShown() {}
-
- // Called when the Bubble is closing and is about to be deleted.
- // |closed_by_escape| is true if the close is the result of the user pressing
- // escape.
- virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape) = 0;
-
- // Whether the Bubble should be closed when the Esc key is pressed.
- virtual bool CloseOnEscape() = 0;
-
- // Whether the Bubble should fade in when opening. When trying to determine
- // whether to use FadeIn, consider whether the bubble is shown as a direct
- // result of a user action or not. For example, if the bubble is being shown
- // as a direct result of a mouse-click, we should not use FadeIn. However, if
- // the bubble appears as a notification that something happened in the
- // background, we use FadeIn.
- virtual bool FadeInOnShow() = 0;
-
- // The name of the window to which this delegate belongs.
- virtual string16 GetAccessibleName();
-};
-
-// TODO(sky): this code is ifdef-tastic. It might be cleaner to refactor the
-// WidgetFoo subclass into a separate class that calls into Bubble.
-// That way Bubble has no (or very few) ifdefs.
-class Bubble
-#if defined(USE_AURA)
- : public views::NativeWidgetAura,
-#elif defined(OS_WIN)
- : public views::NativeWidgetWin,
-#elif defined(TOOLKIT_USES_GTK)
- : public views::NativeWidgetGtk,
-#endif
- public ui::AcceleratorTarget,
- public ui::AnimationDelegate {
- public:
- class Observer {
- public:
- // See BubbleDelegate::BubbleClosing for when this is called.
- virtual void OnBubbleClosing() = 0;
- };
-
- // Shows the Bubble.
- // |parent| is set as the parent window.
- // |contents| are the contents shown in the bubble.
- // |position_relative_to| is a rect in screen coordinates at which the Bubble
- // will point.
- // Show() takes ownership of |contents| and deletes the created Bubble when
- // another window is activated. You can explicitly close the bubble by
- // invoking Close().
- // |arrow_location| specifies preferred bubble alignment.
- // You may provide an optional |delegate| to:
- // - Be notified when the Bubble is closed.
- // - Prevent the Bubble from being closed when the Escape key is
- // pressed (the default behavior).
- static Bubble* Show(views::Widget* parent,
- const gfx::Rect& position_relative_to,
- views::BubbleBorder::ArrowLocation arrow_location,
- views::BubbleBorder::BubbleAlignment alignment,
- views::View* contents,
- BubbleDelegate* delegate);
-
-#if defined(OS_CHROMEOS)
- // Shows the Bubble without grabbing the focus. Doesn't set the Escape
- // accelerator so user code is responsible for closing the bubble on pressing
- // the Esc key. Others are the same as above. TYPE_POPUP widget is used
- // to achieve the focusless effect. If |show_while_screen_is_locked| is true,
- // a property is set telling the window manager to continue showing the bubble
- // even while the screen is locked.
- static Bubble* ShowFocusless(
- views::Widget* parent,
- const gfx::Rect& position_relative_to,
- views::BubbleBorder::ArrowLocation arrow_location,
- views::BubbleBorder::BubbleAlignment alignment,
- views::View* contents,
- BubbleDelegate* delegate,
- bool show_while_screen_is_locked);
-#endif
-
- // Resizes and potentially moves the Bubble to best accommodate the
- // contents preferred size.
- void SizeToContents();
-
- // Whether the Bubble should fade away when it closes. Generally speaking,
- // we use FadeOut when the user selects something within the bubble that
- // causes the bubble to dismiss. We don't use it when the bubble gets
- // deactivated as a result of clicking outside the bubble.
- void set_fade_away_on_close(bool fade_away_on_close) {
- fade_away_on_close_ = fade_away_on_close;
- }
-
- // Whether the Bubble should automatically close when it gets deactivated.
- void set_close_on_deactivate(bool close_on_deactivate) {
- close_on_deactivate_ = close_on_deactivate;
- }
-
- // Overridden from NativeWidget:
- virtual void Close() OVERRIDE;
-
- // Overridden from ui::AnimationDelegate:
- virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
-
-#ifdef UNIT_TEST
- views::View* contents() const { return contents_; }
-#endif
-
- void AddObserver(Observer* obs) {
- observer_list_.AddObserver(obs);
- }
-
- void RemoveObserver(Observer* obs) {
- observer_list_.RemoveObserver(obs);
- }
-
- static const SkColor kBackgroundColor;
-
- protected:
- Bubble();
-#if defined(OS_CHROMEOS)
- Bubble(views::Widget::InitParams::Type type,
- bool show_while_screen_is_locked);
-#endif
- virtual ~Bubble();
-
- // Creates the Bubble.
- virtual void InitBubble(views::Widget* parent,
- const gfx::Rect& position_relative_to,
- views::BubbleBorder::ArrowLocation arrow_location,
- views::BubbleBorder::BubbleAlignment alignment,
- views::View* contents,
- BubbleDelegate* delegate);
-
- // Instantiates and returns the BorderContents this Bubble should use.
- // Subclasses can return their own BorderContents implementation.
- virtual BorderContents* CreateBorderContents();
-
-#if defined(USE_AURA)
- // Overridden from NativeWidgetAura:
- virtual void OnLostActive() OVERRIDE;
-#elif defined(OS_WIN)
- // Overridden from NativeWidgetWin:
- virtual void OnActivate(UINT action, BOOL minimized, HWND window) OVERRIDE;
-#elif defined(TOOLKIT_USES_GTK)
- // Overridden from NativeWidgetGtk:
- virtual void OnActiveChanged() OVERRIDE;
-#endif
-
-#if defined(OS_WIN) && !defined(USE_AURA)
- // The window used to render the padding, border and arrow.
- BorderWidgetWin* border_;
-#else
- // The view displaying the border.
- BorderContents* border_contents_;
-#endif
-
- private:
- enum ShowStatus {
- kOpen,
- kClosing,
- kClosed
- };
-
- // Closes the window notifying the delegate. |closed_by_escape| is true if
- // the close is the result of pressing escape.
- void DoClose(bool closed_by_escape);
-
- // Animates to a visible state.
- void FadeIn();
- // Animates to a hidden state.
- void FadeOut();
-
- // Animates to a visible/hidden state (visible if |fade_in| is true).
- void Fade(bool fade_in);
-
- void RegisterEscapeAccelerator();
- void UnregisterEscapeAccelerator();
-
- // Overridden from AcceleratorTarget:
- virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
-
- // The delegate, if any.
- BubbleDelegate* delegate_;
-
- // The animation used to fade the bubble out.
- scoped_ptr<ui::SlideAnimation> animation_;
-
- // The current visibility status of the bubble.
- ShowStatus show_status_;
-
- // Whether to fade away when the bubble closes.
- bool fade_away_on_close_;
-
- // Whether to close automatically when the bubble deactivates. Defaults to
- // true.
- bool close_on_deactivate_;
-
-#if defined(TOOLKIT_USES_GTK)
- // Some callers want the bubble to be a child control instead of a window.
- views::Widget::InitParams::Type type_;
-#endif
-#if defined(OS_CHROMEOS)
- // Should we set a property telling the window manager to show this window
- // onscreen even when the screen is locked?
- bool show_while_screen_is_locked_;
-#endif
-
- gfx::Rect position_relative_to_;
- views::BubbleBorder::ArrowLocation arrow_location_;
-
- views::View* contents_;
-
- bool accelerator_registered_;
-
- ObserverList<Observer> observer_list_;
-
- DISALLOW_COPY_AND_ASSIGN(Bubble);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BUBBLE_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 3e5d320..a8540e2 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -3312,12 +3312,6 @@
'browser/ui/views/browser_actions_container.cc',
'browser/ui/views/browser_actions_container.h',
'browser/ui/views/browser_dialogs.h',
- 'browser/ui/views/bubble/border_contents.cc',
- 'browser/ui/views/bubble/border_contents.h',
- 'browser/ui/views/bubble/border_widget_win.cc',
- 'browser/ui/views/bubble/border_widget_win.h',
- 'browser/ui/views/bubble/bubble.cc',
- 'browser/ui/views/bubble/bubble.h',
'browser/ui/views/certificate_viewer_win.cc',
'browser/ui/views/chrome_views_delegate.cc',
'browser/ui/views/chrome_views_delegate.h',
@@ -4191,8 +4185,6 @@
['exclude', '^browser/ui/views/app_menu_button_win.cc'],
['exclude', '^browser/ui/views/bookmarks/bookmark_editor_view.cc'],
['exclude', '^browser/ui/views/bookmarks/bookmark_editor_view.h'],
- ['exclude', '^browser/ui/views/bubble/border_widget_win.cc'],
- ['exclude', '^browser/ui/views/bubble/border_widget_win.h'],
['exclude', '^browser/ui/views/certificate_viewer_win.cc'],
['exclude', '^browser/ui/views/collected_cookies_win.cc'],
['exclude', '^browser/ui/views/collected_cookies_win.h'],
@@ -4704,10 +4696,6 @@
['include', '^browser/ui/views/bookmarks/bookmark_menu_delegate.h'],
['include', '^browser/ui/views/browser_actions_container.cc'],
['include', '^browser/ui/views/browser_actions_container.h'],
- ['include', '^browser/ui/views/bubble/border_contents.cc'],
- ['include', '^browser/ui/views/bubble/border_contents.h'],
- ['include', '^browser/ui/views/bubble/bubble.cc'],
- ['include', '^browser/ui/views/bubble/bubble.h'],
['include', '^browser/ui/views/chrome_views_delegate.cc'],
['include', '^browser/ui/views/constrained_html_delegate_gtk.cc'],
['include', '^browser/ui/views/content_setting_bubble_contents.cc'],