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 {
BubbleFrameView::BubbleFrameView(views::Widget* frame,
views::WidgetDelegate* widget_delegate,
BubbleWindowStyle style)
DialogStyle style)
: frame_(frame),
style_(style),
title_(NULL),
......
......@@ -33,7 +33,7 @@ class BubbleFrameView : public views::NonClientFrameView,
public:
BubbleFrameView(views::Widget* frame,
views::WidgetDelegate* widget_delegate,
BubbleWindowStyle style);
DialogStyle style);
virtual ~BubbleFrameView();
// Overridden from views::NonClientFrameView:
......@@ -65,7 +65,7 @@ class BubbleFrameView : public views::NonClientFrameView,
views::Widget* frame_;
// Allows to tweak appearance of the view.
BubbleWindowStyle style_;
DialogStyle style_;
// Title label
views::Label* title_;
......@@ -85,4 +85,3 @@ class BubbleFrameView : public views::NonClientFrameView,
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_FRAME_BUBBLE_FRAME_VIEW_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 @@ namespace chromeos {
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 @@ class BubbleWindow : public views::NativeWidgetGtk {
virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
private:
BubbleWindowStyle style_;
DialogStyle style_;
DISALLOW_COPY_AND_ASSIGN(BubbleWindow);
};
......@@ -55,7 +56,7 @@ namespace chromeos {
class BubbleWindow {
public:
static views::Widget* Create(gfx::NativeWindow parent,
BubbleWindowStyle style,
DialogStyle style,
views::WidgetDelegate* widget_delegate) {
NOTIMPLEMENTED();
return NULL;
......
......@@ -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::NonClientFrameView* BubbleWindow::CreateNonClientFrameView() {
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);
......
......@@ -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
......
......@@ -61,7 +61,7 @@ void LoginHtmlDialog::Show() {
#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());
......
// 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,
// 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
......
......@@ -95,7 +95,7 @@ void KeyboardOverlayDialogView::ShowDialog(
delegate->set_view(html_view);
html_view->InitDialog();
chromeos::BubbleWindow::Create(owning_window,
chromeos::STYLE_FLUSH,
STYLE_FLUSH,
html_view);
html_view->GetWidget()->Show();
}
......
......@@ -18,7 +18,7 @@ views::Widget* CreateViewsWindow(gfx::NativeWindow parent,
// 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
......
......@@ -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',
......
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