Promote bubble_window_style to more general dialog_style.
In order to theme certificate viewer html dialog with a different style on
chromeos, we need to promote bubble_window_style to more general dialog_style.
This way, DialogStyle can be used as a parameter for function ShowHTMLDialog.
However, only chromeos builds will use this parameter, others just ignore it.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/8469006
Patch from Biao She <bshe@chromium.org>.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110731 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/chromeos/frame/bubble_frame_view.cc b/chrome/browser/chromeos/frame/bubble_frame_view.cc
index a11e4db4..dd41852 100644
--- a/chrome/browser/chromeos/frame/bubble_frame_view.cc
+++ b/chrome/browser/chromeos/frame/bubble_frame_view.cc
@@ -44,7 +44,7 @@
BubbleFrameView::BubbleFrameView(views::Widget* frame,
views::WidgetDelegate* widget_delegate,
- BubbleWindowStyle style)
+ DialogStyle style)
: frame_(frame),
style_(style),
title_(NULL),
diff --git a/chrome/browser/chromeos/frame/bubble_frame_view.h b/chrome/browser/chromeos/frame/bubble_frame_view.h
index 98db47e..aba528f 100644
--- a/chrome/browser/chromeos/frame/bubble_frame_view.h
+++ b/chrome/browser/chromeos/frame/bubble_frame_view.h
@@ -33,7 +33,7 @@
public:
BubbleFrameView(views::Widget* frame,
views::WidgetDelegate* widget_delegate,
- BubbleWindowStyle style);
+ DialogStyle style);
virtual ~BubbleFrameView();
// Overridden from views::NonClientFrameView:
@@ -65,7 +65,7 @@
views::Widget* frame_;
// Allows to tweak appearance of the view.
- BubbleWindowStyle style_;
+ DialogStyle style_;
// Title label
views::Label* title_;
@@ -85,4 +85,3 @@
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_FRAME_BUBBLE_FRAME_VIEW_H_
-
diff --git a/chrome/browser/chromeos/frame/bubble_window.h b/chrome/browser/chromeos/frame/bubble_window.h
index 2ad6e92..5d3ca04a 100644
--- a/chrome/browser/chromeos/frame/bubble_window.h
+++ b/chrome/browser/chromeos/frame/bubble_window.h
@@ -7,6 +7,7 @@
#pragma once
#include "chrome/browser/chromeos/frame/bubble_window_style.h"
+#include "chrome/browser/ui/dialog_style.h"
#if defined(TOOLKIT_USES_GTK)
// TODO(msw): While I dislike the includes and code to be mixed into the same
@@ -29,11 +30,11 @@
class BubbleWindow : public views::NativeWidgetGtk {
public:
static views::Widget* Create(gfx::NativeWindow parent,
- BubbleWindowStyle style,
+ DialogStyle style,
views::WidgetDelegate* widget_delegate);
protected:
- BubbleWindow(views::Widget* window, BubbleWindowStyle style);
+ BubbleWindow(views::Widget* window, DialogStyle style);
// Overridden from views::NativeWidgetGtk:
virtual void InitNativeWidget(
@@ -41,7 +42,7 @@
virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
private:
- BubbleWindowStyle style_;
+ DialogStyle style_;
DISALLOW_COPY_AND_ASSIGN(BubbleWindow);
};
@@ -55,7 +56,7 @@
class BubbleWindow {
public:
static views::Widget* Create(gfx::NativeWindow parent,
- BubbleWindowStyle style,
+ DialogStyle style,
views::WidgetDelegate* widget_delegate) {
NOTIMPLEMENTED();
return NULL;
diff --git a/chrome/browser/chromeos/frame/bubble_window_gtk.cc b/chrome/browser/chromeos/frame/bubble_window_gtk.cc
index 9f1283b..67846e6 100644
--- a/chrome/browser/chromeos/frame/bubble_window_gtk.cc
+++ b/chrome/browser/chromeos/frame/bubble_window_gtk.cc
@@ -13,7 +13,7 @@
namespace chromeos {
BubbleWindow::BubbleWindow(views::Widget* window,
- BubbleWindowStyle style)
+ DialogStyle style)
: views::NativeWidgetGtk(window),
style_(style) {
}
@@ -47,7 +47,7 @@
views::Widget* BubbleWindow::Create(
gfx::NativeWindow parent,
- BubbleWindowStyle style,
+ DialogStyle style,
views::WidgetDelegate* widget_delegate) {
views::Widget* window = new views::Widget;
BubbleWindow* bubble_window = new BubbleWindow(window, style);
diff --git a/chrome/browser/chromeos/frame/bubble_window_style.h b/chrome/browser/chromeos/frame/bubble_window_style.h
index 44073715..3bfdb45 100644
--- a/chrome/browser/chromeos/frame/bubble_window_style.h
+++ b/chrome/browser/chromeos/frame/bubble_window_style.h
@@ -10,23 +10,6 @@
namespace chromeos {
-// A class to share common definitions between GTK and Views implementations.
-enum BubbleWindowStyle {
- // Default style.
- STYLE_GENERIC = 0,
-
- // Show close button at the top right (left for RTL).
- // Deprecated, see BubbleWindow::Create().
- STYLE_XBAR = 1 << 0,
-
- // Show throbber for slow rendering.
- // Deprecated, see BubbleWindow::Create().
- STYLE_THROBBER = 1 << 1,
-
- // Content flush to edge, no padding.
- STYLE_FLUSH = 1 << 2
-};
-
extern const SkColor kBubbleWindowBackgroundColor;
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/login_html_dialog.cc b/chrome/browser/chromeos/login/login_html_dialog.cc
index 3ab848d..6b1409c 100644
--- a/chrome/browser/chromeos/login/login_html_dialog.cc
+++ b/chrome/browser/chromeos/login/login_html_dialog.cc
@@ -61,7 +61,7 @@
#else
if (style_ & STYLE_BUBBLE) {
views::Widget* bubble_window = BubbleWindow::Create(parent_window_,
- static_cast<BubbleWindowStyle>(STYLE_XBAR | STYLE_THROBBER),
+ static_cast<DialogStyle>(STYLE_XBAR | STYLE_THROBBER),
html_view);
bubble_frame_view_ = static_cast<BubbleFrameView*>(
bubble_window->non_client_view()->frame_view());
diff --git a/chrome/browser/ui/dialog_style.h b/chrome/browser/ui/dialog_style.h
new file mode 100644
index 0000000..31299ca
--- /dev/null
+++ b/chrome/browser/ui/dialog_style.h
@@ -0,0 +1,33 @@
+// 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_DIALOG_STYLE_H_
+#define CHROME_BROWSER_UI_DIALOG_STYLE_H_
+#pragma once
+
+#include "third_party/skia/include/core/SkColor.h"
+
+// A class to share common definitions between GTK and Views implementations.
+enum DialogStyle {
+ // Default style.
+ STYLE_GENERIC = 0,
+
+#if defined(OS_CHROMEOS)
+ // Show close button at the top right (left for RTL).
+ // Deprecated, see BubbleWindow::Create().
+ // TODO(bshe): We probably need to use this style for certificate viewer
+ // HTML dialog.
+ STYLE_XBAR = 1 << 0,
+
+ // Show throbber for slow rendering.
+ // Deprecated, see BubbleWindow::Create().
+ STYLE_THROBBER = 1 << 1,
+
+ // Content flush to edge, no padding.
+ STYLE_FLUSH = 1 << 2
+#endif
+
+};
+
+#endif // CHROME_BROWSER_UI_DIALOG_STYLE_H_
diff --git a/chrome/browser/ui/views/extensions/extension_dialog.cc b/chrome/browser/ui/views/extensions/extension_dialog.cc
index 1269e82..693e058 100644
--- a/chrome/browser/ui/views/extensions/extension_dialog.cc
+++ b/chrome/browser/ui/views/extensions/extension_dialog.cc
@@ -34,7 +34,7 @@
// On Chrome OS we need to override the style to suppress padding around
// the borders.
return chromeos::BubbleWindow::Create(parent,
- chromeos::STYLE_FLUSH, delegate);
+ STYLE_FLUSH, delegate);
#else
return browser::CreateViewsWindow(parent, delegate);
#endif
diff --git a/chrome/browser/ui/views/keyboard_overlay_dialog_view.cc b/chrome/browser/ui/views/keyboard_overlay_dialog_view.cc
index 9d45ae0..d1c7436 100644
--- a/chrome/browser/ui/views/keyboard_overlay_dialog_view.cc
+++ b/chrome/browser/ui/views/keyboard_overlay_dialog_view.cc
@@ -95,7 +95,7 @@
delegate->set_view(html_view);
html_view->InitDialog();
chromeos::BubbleWindow::Create(owning_window,
- chromeos::STYLE_FLUSH,
+ STYLE_FLUSH,
html_view);
html_view->GetWidget()->Show();
}
diff --git a/chrome/browser/ui/views/window.cc b/chrome/browser/ui/views/window.cc
index 539bdd5..6199ecf 100644
--- a/chrome/browser/ui/views/window.cc
+++ b/chrome/browser/ui/views/window.cc
@@ -18,7 +18,7 @@
// TODO(msw): revert to BubbleWindow for all ChromeOS cases when CL
// for crbug.com/98322 is landed.
return chromeos::BubbleWindow::Create(parent,
- chromeos::STYLE_GENERIC, delegate);
+ STYLE_GENERIC, delegate);
#else
return views::Widget::CreateWindowWithParent(delegate, parent);
#endif
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index b8c9a16..a03ac641 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2883,6 +2883,7 @@
'browser/ui/crypto_module_password_dialog.h',
'browser/ui/crypto_module_password_dialog_nss.cc',
'browser/ui/crypto_module_password_dialog_openssl.cc',
+ 'browser/ui/dialog_style.h',
'browser/ui/find_bar/find_bar.h',
'browser/ui/find_bar/find_bar_controller.cc',
'browser/ui/find_bar/find_bar_controller.h',