diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-23 18:52:35 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-23 18:52:35 +0000 |
commit | 8a1cc07176574962b360ff826015c74beecc87d2 (patch) | |
tree | b4c93f0b0667cee474cb4317e2ecb12514a47887 /chrome/browser/ui/views/frame | |
parent | 2d758a10306f871b80b9584c8a1f080fd455ebdb (diff) | |
download | chromium_src-8a1cc07176574962b360ff826015c74beecc87d2.zip chromium_src-8a1cc07176574962b360ff826015c74beecc87d2.tar.gz chromium_src-8a1cc07176574962b360ff826015c74beecc87d2.tar.bz2 |
Add an option to run Chrome in the views desktop.
- Add a BrowserFrameViews stub.
- Add a NativeTabContentsViewViews stub.
- Allow the omnibox to run in pure-views mode on Windows too.
- Make the RenderWidgetHostViewViews build on Windows.
chrome --use-pure-views --views-desktop runs, shows a browser window, but doesn't really do anything else.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7206055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90242 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/views/frame')
4 files changed, 90 insertions, 0 deletions
diff --git a/chrome/browser/ui/views/frame/browser_frame_gtk.cc b/chrome/browser/ui/views/frame/browser_frame_gtk.cc index 5513a98..dd19ae8 100644 --- a/chrome/browser/ui/views/frame/browser_frame_gtk.cc +++ b/chrome/browser/ui/views/frame/browser_frame_gtk.cc @@ -10,10 +10,12 @@ #include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/ui/status_bubble.h" #include "chrome/browser/ui/views/frame/app_panel_browser_frame_view.h" +#include "chrome/browser/ui/views/frame/browser_frame_views.h" #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "ui/gfx/font.h" #include "views/widget/root_view.h" +#include "views/widget/widget.h" #include "views/window/hit_test.h" // static @@ -89,6 +91,8 @@ gboolean BrowserFrameGtk::OnConfigureEvent(GtkWidget* widget, NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( BrowserFrame* browser_frame, BrowserView* browser_view) { + if (views::Widget::IsPureViews()) + return new BrowserFrameViews(browser_frame, browser_view); return new BrowserFrameGtk(browser_frame, browser_view); } diff --git a/chrome/browser/ui/views/frame/browser_frame_views.cc b/chrome/browser/ui/views/frame/browser_frame_views.cc new file mode 100644 index 0000000..8cee9ba --- /dev/null +++ b/chrome/browser/ui/views/frame/browser_frame_views.cc @@ -0,0 +1,37 @@ +// 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/frame/browser_frame_views.h" + +//////////////////////////////////////////////////////////////////////////////// +// BrowserFrameViews, public: + +BrowserFrameViews::BrowserFrameViews(BrowserFrame* browser_frame, + BrowserView* browser_view) + : views::NativeWidgetViews(browser_frame), + browser_view_(browser_view), + browser_frame_(browser_frame) { +} + +BrowserFrameViews::~BrowserFrameViews() { +} + +//////////////////////////////////////////////////////////////////////////////// +// BrowserFrameViews, NativeBrowserFrame implementation: + +views::NativeWidget* BrowserFrameViews::AsNativeWidget() { + return this; +} + +const views::NativeWidget* BrowserFrameViews::AsNativeWidget() const { + return this; +} + +int BrowserFrameViews::GetMinimizeButtonOffset() const { + return 0; +} + +void BrowserFrameViews::TabStripDisplayModeChanged() { +} + diff --git a/chrome/browser/ui/views/frame/browser_frame_views.h b/chrome/browser/ui/views/frame/browser_frame_views.h new file mode 100644 index 0000000..bf9dc79 --- /dev/null +++ b/chrome/browser/ui/views/frame/browser_frame_views.h @@ -0,0 +1,46 @@ +// 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_FRAME_BROWSER_FRAME_VIEWS_H_ +#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_VIEWS_H_ +#pragma once + +#include "base/basictypes.h" +#include "chrome/browser/ui/views/frame/browser_frame.h" +#include "chrome/browser/ui/views/frame/native_browser_frame.h" +#include "views/widget/native_widget_views.h" + +class BrowserView; + +//////////////////////////////////////////////////////////////////////////////// +// BrowserFrameViews +// +// BrowserFrameViews is a NativeWidgetViews subclass that provides the window +// frame for the Chrome browser window. +// +class BrowserFrameViews : public views::NativeWidgetViews, + public NativeBrowserFrame { + public: + BrowserFrameViews(BrowserFrame* browser_frame, BrowserView* browser_view); + virtual ~BrowserFrameViews(); + + BrowserView* browser_view() const { return browser_view_; } + + protected: + // Overridden from NativeBrowserFrame: + virtual views::NativeWidget* AsNativeWidget() OVERRIDE; + virtual const views::NativeWidget* AsNativeWidget() const OVERRIDE; + virtual int GetMinimizeButtonOffset() const OVERRIDE; + virtual void TabStripDisplayModeChanged() OVERRIDE; + + private: + // The BrowserView is our ClientView. This is a pointer to it. + BrowserView* browser_view_; + + BrowserFrame* browser_frame_; + + DISALLOW_COPY_AND_ASSIGN(BrowserFrameViews); +}; + +#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_VIEWS_H_ diff --git a/chrome/browser/ui/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc index 1d2d4f5..e3f5cdc 100644 --- a/chrome/browser/ui/views/frame/browser_frame_win.cc +++ b/chrome/browser/ui/views/frame/browser_frame_win.cc @@ -11,6 +11,7 @@ #include "chrome/browser/accessibility/browser_accessibility_state.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/views/frame/browser_frame_views.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "grit/theme_resources.h" #include "ui/base/theme_provider.h" @@ -216,6 +217,8 @@ const gfx::Font& BrowserFrame::GetTitleFont() { NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( BrowserFrame* browser_frame, BrowserView* browser_view) { + if (views::Widget::IsPureViews()) + return new BrowserFrameViews(browser_frame, browser_view); return new BrowserFrameWin(browser_frame, browser_view); } |