summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 16:10:45 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 16:10:45 +0000
commitded49f8fc73b04689433c062da4a09a9fbe0ff7c (patch)
tree1564036a8571ff2199bd2d5a236985be621a66c7 /chrome/browser
parent4c8988c7d6e51c8308cd55c59697784566da116b (diff)
downloadchromium_src-ded49f8fc73b04689433c062da4a09a9fbe0ff7c.zip
chromium_src-ded49f8fc73b04689433c062da4a09a9fbe0ff7c.tar.gz
chromium_src-ded49f8fc73b04689433c062da4a09a9fbe0ff7c.tar.bz2
Gets the loading theme bubble to work on views/gtk.
CROS_BUG=1080 TEST=install a theme on chrome os and make sure you get the 'Loading...' bubble. Review URL: http://codereview.chromium.org/543024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36121 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/views/frame/browser_view.cc10
-rw-r--r--chrome/browser/views/theme_install_bubble_view.cc27
-rw-r--r--chrome/browser/views/theme_install_bubble_view.h34
3 files changed, 33 insertions, 38 deletions
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index b03129e..9d0a14e 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -46,6 +46,7 @@
#include "chrome/browser/views/status_bubble_views.h"
#include "chrome/browser/views/tab_contents/tab_contents_container.h"
#include "chrome/browser/views/tabs/tab_strip.h"
+#include "chrome/browser/views/theme_install_bubble_view.h"
#include "chrome/browser/views/toolbar_star_toggle.h"
#include "chrome/browser/views/toolbar_view.h"
#include "chrome/browser/sessions/tab_restore_service.h"
@@ -79,7 +80,6 @@
#if defined(OS_WIN)
#include "app/win_util.h"
#include "chrome/browser/jumplist.h"
-#include "chrome/browser/views/theme_install_bubble_view.h"
#elif defined(OS_LINUX)
#include "chrome/browser/views/accelerator_table_gtk.h"
#include "views/window/hit_test.h"
@@ -1099,18 +1099,10 @@ void BrowserView::ShowProfileErrorDialog(int message_id) {
}
void BrowserView::ShowThemeInstallBubble() {
-#if defined(OS_WIN)
TabContents* tab_contents = browser_->GetSelectedTabContents();
if (!tab_contents)
return;
ThemeInstallBubbleView::Show(tab_contents);
-#elif defined(OS_LINUX)
- // Alas, the Views version of ThemeInstallBubbleView is Windows Views only.
- // http://crbug.com/24360
- NOTIMPLEMENTED();
-#else
- NOTIMPLEMENTED();
-#endif
}
void BrowserView::ConfirmBrowserCloseWithPendingDownloads() {
diff --git a/chrome/browser/views/theme_install_bubble_view.cc b/chrome/browser/views/theme_install_bubble_view.cc
index 25791e7..6d31a3a 100644
--- a/chrome/browser/views/theme_install_bubble_view.cc
+++ b/chrome/browser/views/theme_install_bubble_view.cc
@@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/views/theme_install_bubble_view.h"
+
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "chrome/browser/views/theme_install_bubble_view.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
#include "grit/generated_resources.h"
+#include "views/widget/widget.h"
namespace {
@@ -27,7 +30,7 @@ ThemeInstallBubbleView::ThemeInstallBubbleView(TabContents* tab_contents)
if (!tab_contents)
Close();
- text_ = l10n_util::GetStringUTF16(IDS_THEME_LOADING_TITLE);
+ text_ = l10n_util::GetString(IDS_THEME_LOADING_TITLE);
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
gfx::Font font(rb.GetFont(ResourceBundle::LargeFont));
SetFont(font);
@@ -65,10 +68,9 @@ ThemeInstallBubbleView::ThemeInstallBubbleView(TabContents* tab_contents)
NotificationService::AllSources());
gfx::Rect rc(0, 0, 0, 0);
- popup_ = new views::WidgetWin;
- popup_->set_window_style(WS_POPUP);
- popup_->set_window_ex_style(WS_EX_LAYERED | WS_EX_TOOLWINDOW |
- WS_EX_TRANSPARENT);
+ popup_ = views::Widget::CreatePopupWidget(views::Widget::Transparent,
+ views::Widget::NotAcceptEvents,
+ views::Widget::DeleteOnDestroy);
popup_->SetOpacity(0xCC);
popup_->Init(tab_contents->GetNativeView(), rc);
popup_->SetContentsView(this);
@@ -103,7 +105,7 @@ void ThemeInstallBubbleView::Reposition() {
(tab_contents_bounds_.bottom() - tab_contents_bounds_.y()) / 2 -
size.height() / 2);
- popup_->MoveWindow(x, y, size.width(), size.height());
+ popup_->SetBounds(gfx::Rect(x, y, size.width(), size.height()));
}
void ThemeInstallBubbleView::Paint(gfx::Canvas* canvas) {
@@ -111,26 +113,21 @@ void ThemeInstallBubbleView::Paint(gfx::Canvas* canvas) {
for (int i = 0; i < 8; ++i)
rad[i] = SkIntToScalar(kBubbleCornerRadius);
- gfx::Rect popup_bounds;
- popup_->GetBounds(&popup_bounds, true);
-
SkPaint paint;
paint.setStyle(SkPaint::kFill_Style);
paint.setFlags(SkPaint::kAntiAlias_Flag);
paint.setColor(SK_ColorBLACK);
- int width = popup_bounds.width();
- int height = popup_bounds.height();
SkRect rect;
rect.set(0, 0,
- SkIntToScalar(width),
- SkIntToScalar(height));
+ SkIntToScalar(width()),
+ SkIntToScalar(height()));
SkPath path;
path.addRoundRect(rect, rad, SkPath::kCW_Direction);
canvas->drawPath(path, paint);
int text_width = views::Label::GetFont().GetStringWidth(text_);
- gfx::Rect body_bounds(kTextHorizPadding / 2, 0, text_width, height);
+ gfx::Rect body_bounds(kTextHorizPadding / 2, 0, text_width, height());
body_bounds.set_x(MirroredLeftPointForRect(body_bounds));
SkColor text_color = SK_ColorWHITE;
diff --git a/chrome/browser/views/theme_install_bubble_view.h b/chrome/browser/views/theme_install_bubble_view.h
index 694862e..ff08621 100644
--- a/chrome/browser/views/theme_install_bubble_view.h
+++ b/chrome/browser/views/theme_install_bubble_view.h
@@ -5,12 +5,18 @@
#ifndef CHROME_BROWSER_VIEWS_THEME_INSTALL_BUBBLE_VIEW_H_
#define CHROME_BROWSER_VIEWS_THEME_INSTALL_BUBBLE_VIEW_H_
+#include <string>
+
#include "app/gfx/canvas.h"
-#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/notification_service.h"
#include "views/controls/label.h"
-#include "views/widget/widget_win.h"
+
+class TabContents;
+
+namespace views {
+class Widget;
+}
// ThemeInstallBubbleView is a view that provides a "Loading..." bubble in the
// center of a browser window for use when an extension or theme is loaded.
@@ -41,18 +47,6 @@ class ThemeInstallBubbleView : public NotificationObserver,
private:
explicit ThemeInstallBubbleView(TabContents* tab_contents);
- // The content area at the start of the animation.
- gfx::Rect tab_contents_bounds_;
-
- // We use a HWND for the popup so that it may float above any HWNDs in our UI.
- views::WidgetWin* popup_;
-
- // Text to show warning that theme is being installed.
- std::wstring text_;
-
- // A scoped container for notification registries.
- NotificationRegistrar registrar_;
-
// Put the popup in the correct place on the tab.
void Reposition();
@@ -64,6 +58,18 @@ class ThemeInstallBubbleView : public NotificationObserver,
virtual void Paint(gfx::Canvas* canvas);
+ // The content area at the start of the animation.
+ gfx::Rect tab_contents_bounds_;
+
+ // Widget containing us.
+ views::Widget* popup_;
+
+ // Text to show warning that theme is being installed.
+ std::wstring text_;
+
+ // A scoped container for notification registries.
+ NotificationRegistrar registrar_;
+
DISALLOW_COPY_AND_ASSIGN(ThemeInstallBubbleView);
};