Commit 5207e932 authored by rbyers@chromium.org's avatar rbyers@chromium.org

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
parent 2c16ac8c
...@@ -44,7 +44,7 @@ namespace chromeos { ...@@ -44,7 +44,7 @@ namespace chromeos {
BubbleFrameView::BubbleFrameView(views::Widget* frame, BubbleFrameView::BubbleFrameView(views::Widget* frame,
views::WidgetDelegate* widget_delegate, views::WidgetDelegate* widget_delegate,
BubbleWindowStyle style) DialogStyle style)
: frame_(frame), : frame_(frame),
style_(style), style_(style),
title_(NULL), title_(NULL),
......
...@@ -33,7 +33,7 @@ class BubbleFrameView : public views::NonClientFrameView, ...@@ -33,7 +33,7 @@ class BubbleFrameView : public views::NonClientFrameView,
public: public:
BubbleFrameView(views::Widget* frame, BubbleFrameView(views::Widget* frame,
views::WidgetDelegate* widget_delegate, views::WidgetDelegate* widget_delegate,
BubbleWindowStyle style); DialogStyle style);
virtual ~BubbleFrameView(); virtual ~BubbleFrameView();
// Overridden from views::NonClientFrameView: // Overridden from views::NonClientFrameView:
...@@ -65,7 +65,7 @@ class BubbleFrameView : public views::NonClientFrameView, ...@@ -65,7 +65,7 @@ class BubbleFrameView : public views::NonClientFrameView,
views::Widget* frame_; views::Widget* frame_;
// Allows to tweak appearance of the view. // Allows to tweak appearance of the view.
BubbleWindowStyle style_; DialogStyle style_;
// Title label // Title label
views::Label* title_; views::Label* title_;
...@@ -85,4 +85,3 @@ class BubbleFrameView : public views::NonClientFrameView, ...@@ -85,4 +85,3 @@ class BubbleFrameView : public views::NonClientFrameView,
} // namespace chromeos } // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_FRAME_BUBBLE_FRAME_VIEW_H_ #endif // CHROME_BROWSER_CHROMEOS_FRAME_BUBBLE_FRAME_VIEW_H_
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#pragma once #pragma once
#include "chrome/browser/chromeos/frame/bubble_window_style.h" #include "chrome/browser/chromeos/frame/bubble_window_style.h"
#include "chrome/browser/ui/dialog_style.h"
#if defined(TOOLKIT_USES_GTK) #if defined(TOOLKIT_USES_GTK)
// TODO(msw): While I dislike the includes and code to be mixed into the same // TODO(msw): While I dislike the includes and code to be mixed into the same
...@@ -29,11 +30,11 @@ namespace chromeos { ...@@ -29,11 +30,11 @@ namespace chromeos {
class BubbleWindow : public views::NativeWidgetGtk { class BubbleWindow : public views::NativeWidgetGtk {
public: public:
static views::Widget* Create(gfx::NativeWindow parent, static views::Widget* Create(gfx::NativeWindow parent,
BubbleWindowStyle style, DialogStyle style,
views::WidgetDelegate* widget_delegate); views::WidgetDelegate* widget_delegate);
protected: protected:
BubbleWindow(views::Widget* window, BubbleWindowStyle style); BubbleWindow(views::Widget* window, DialogStyle style);
// Overridden from views::NativeWidgetGtk: // Overridden from views::NativeWidgetGtk:
virtual void InitNativeWidget( virtual void InitNativeWidget(
...@@ -41,7 +42,7 @@ class BubbleWindow : public views::NativeWidgetGtk { ...@@ -41,7 +42,7 @@ class BubbleWindow : public views::NativeWidgetGtk {
virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
private: private:
BubbleWindowStyle style_; DialogStyle style_;
DISALLOW_COPY_AND_ASSIGN(BubbleWindow); DISALLOW_COPY_AND_ASSIGN(BubbleWindow);
}; };
...@@ -55,7 +56,7 @@ namespace chromeos { ...@@ -55,7 +56,7 @@ namespace chromeos {
class BubbleWindow { class BubbleWindow {
public: public:
static views::Widget* Create(gfx::NativeWindow parent, static views::Widget* Create(gfx::NativeWindow parent,
BubbleWindowStyle style, DialogStyle style,
views::WidgetDelegate* widget_delegate) { views::WidgetDelegate* widget_delegate) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return NULL; return NULL;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
namespace chromeos { namespace chromeos {
BubbleWindow::BubbleWindow(views::Widget* window, BubbleWindow::BubbleWindow(views::Widget* window,
BubbleWindowStyle style) DialogStyle style)
: views::NativeWidgetGtk(window), : views::NativeWidgetGtk(window),
style_(style) { style_(style) {
} }
...@@ -47,7 +47,7 @@ views::NonClientFrameView* BubbleWindow::CreateNonClientFrameView() { ...@@ -47,7 +47,7 @@ views::NonClientFrameView* BubbleWindow::CreateNonClientFrameView() {
views::Widget* BubbleWindow::Create( views::Widget* BubbleWindow::Create(
gfx::NativeWindow parent, gfx::NativeWindow parent,
BubbleWindowStyle style, DialogStyle style,
views::WidgetDelegate* widget_delegate) { views::WidgetDelegate* widget_delegate) {
views::Widget* window = new views::Widget; views::Widget* window = new views::Widget;
BubbleWindow* bubble_window = new BubbleWindow(window, style); BubbleWindow* bubble_window = new BubbleWindow(window, style);
......
...@@ -10,23 +10,6 @@ ...@@ -10,23 +10,6 @@
namespace chromeos { 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; extern const SkColor kBubbleWindowBackgroundColor;
} // namespace chromeos } // namespace chromeos
......
...@@ -61,7 +61,7 @@ void LoginHtmlDialog::Show() { ...@@ -61,7 +61,7 @@ void LoginHtmlDialog::Show() {
#else #else
if (style_ & STYLE_BUBBLE) { if (style_ & STYLE_BUBBLE) {
views::Widget* bubble_window = BubbleWindow::Create(parent_window_, views::Widget* bubble_window = BubbleWindow::Create(parent_window_,
static_cast<BubbleWindowStyle>(STYLE_XBAR | STYLE_THROBBER), static_cast<DialogStyle>(STYLE_XBAR | STYLE_THROBBER),
html_view); html_view);
bubble_frame_view_ = static_cast<BubbleFrameView*>( bubble_frame_view_ = static_cast<BubbleFrameView*>(
bubble_window->non_client_view()->frame_view()); bubble_window->non_client_view()->frame_view());
......
// 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_
...@@ -34,7 +34,7 @@ views::Widget* CreateWindow(gfx::NativeWindow parent, ...@@ -34,7 +34,7 @@ views::Widget* CreateWindow(gfx::NativeWindow parent,
// On Chrome OS we need to override the style to suppress padding around // On Chrome OS we need to override the style to suppress padding around
// the borders. // the borders.
return chromeos::BubbleWindow::Create(parent, return chromeos::BubbleWindow::Create(parent,
chromeos::STYLE_FLUSH, delegate); STYLE_FLUSH, delegate);
#else #else
return browser::CreateViewsWindow(parent, delegate); return browser::CreateViewsWindow(parent, delegate);
#endif #endif
......
...@@ -95,7 +95,7 @@ void KeyboardOverlayDialogView::ShowDialog( ...@@ -95,7 +95,7 @@ void KeyboardOverlayDialogView::ShowDialog(
delegate->set_view(html_view); delegate->set_view(html_view);
html_view->InitDialog(); html_view->InitDialog();
chromeos::BubbleWindow::Create(owning_window, chromeos::BubbleWindow::Create(owning_window,
chromeos::STYLE_FLUSH, STYLE_FLUSH,
html_view); html_view);
html_view->GetWidget()->Show(); html_view->GetWidget()->Show();
} }
......
...@@ -18,7 +18,7 @@ views::Widget* CreateViewsWindow(gfx::NativeWindow parent, ...@@ -18,7 +18,7 @@ views::Widget* CreateViewsWindow(gfx::NativeWindow parent,
// TODO(msw): revert to BubbleWindow for all ChromeOS cases when CL // TODO(msw): revert to BubbleWindow for all ChromeOS cases when CL
// for crbug.com/98322 is landed. // for crbug.com/98322 is landed.
return chromeos::BubbleWindow::Create(parent, return chromeos::BubbleWindow::Create(parent,
chromeos::STYLE_GENERIC, delegate); STYLE_GENERIC, delegate);
#else #else
return views::Widget::CreateWindowWithParent(delegate, parent); return views::Widget::CreateWindowWithParent(delegate, parent);
#endif #endif
......
...@@ -2883,6 +2883,7 @@ ...@@ -2883,6 +2883,7 @@
'browser/ui/crypto_module_password_dialog.h', 'browser/ui/crypto_module_password_dialog.h',
'browser/ui/crypto_module_password_dialog_nss.cc', 'browser/ui/crypto_module_password_dialog_nss.cc',
'browser/ui/crypto_module_password_dialog_openssl.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.h',
'browser/ui/find_bar/find_bar_controller.cc', 'browser/ui/find_bar/find_bar_controller.cc',
'browser/ui/find_bar/find_bar_controller.h', 'browser/ui/find_bar/find_bar_controller.h',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment