summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/frame/browser_frame_chromeos.cc22
-rw-r--r--chrome/browser/chromeos/frame/browser_view.cc4
-rw-r--r--chrome/browser/views/frame/browser_frame_gtk.cc41
-rw-r--r--chrome/browser/views/frame/popup_non_client_frame_view.cc54
-rw-r--r--chrome/browser/views/frame/popup_non_client_frame_view.h39
-rw-r--r--chrome/chrome_browser.gypi4
6 files changed, 115 insertions, 49 deletions
diff --git a/chrome/browser/chromeos/frame/browser_frame_chromeos.cc b/chrome/browser/chromeos/frame/browser_frame_chromeos.cc
index cc68f68..d55e6ce 100644
--- a/chrome/browser/chromeos/frame/browser_frame_chromeos.cc
+++ b/chrome/browser/chromeos/frame/browser_frame_chromeos.cc
@@ -6,6 +6,8 @@
#include "chrome/browser/chromeos/frame/normal_browser_frame_view.h"
#include "chrome/browser/views/frame/browser_view.h"
+#include "chrome/browser/views/frame/opaque_browser_frame_view.h"
+#include "chrome/browser/views/frame/popup_non_client_frame_view.h"
// static (Factory method.)
BrowserFrame* BrowserFrame::Create(BrowserView* browser_view,
@@ -27,15 +29,19 @@ BrowserFrameChromeos::~BrowserFrameChromeos() {
}
void BrowserFrameChromeos::Init() {
- // Excludes a browser intance that requires icon/title. This is typically true
- // for dev tools and javascript console.
- // TODO(oshima): handle app panels. This currently uses the default
- // implementation, which opens Chrome's app panel instead of
- // ChromeOS's panel.
- if (!IsPanel() &&
- !browser_view()->ShouldShowWindowIcon() &&
- !browser_view()->ShouldShowWindowTitle()) {
+ // NOTE: This logic supersedes the logic in BrowserFrameGtk::Init()
+ // by always setting browser_frame_view_.
+ if (IsPanel()) {
+ // ChromeOS Panels should always use PopupNonClientFrameView.
+ set_browser_frame_view(new PopupNonClientFrameView());
+ } else if (!browser_view()->ShouldShowWindowIcon() &&
+ !browser_view()->ShouldShowWindowTitle()) {
+ // Excludes a browser intance that requires icon/title.
+ // This is typically true for dev tools and javascript console.
set_browser_frame_view(new NormalBrowserFrameView(this, browser_view()));
+ } else {
+ // Default FrameView.
+ set_browser_frame_view(new OpaqueBrowserFrameView(this, browser_view()));
}
BrowserFrameGtk::Init();
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc
index 23d4debb..4fe7661 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -445,7 +445,9 @@ void BrowserView::UpdateOTRBackground() {
BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
// Create a browser view for chromeos.
BrowserView* view;
- if (browser->type() & (Browser::TYPE_POPUP | Browser::TYPE_APP_PANEL))
+ if ((browser->type() == Browser::TYPE_POPUP) ||
+ (browser->type() == Browser::TYPE_APP_POPUP) ||
+ (browser->type() == Browser::TYPE_APP_PANEL))
view = new chromeos::PanelBrowserView(browser);
else
view = new chromeos::BrowserView(browser);
diff --git a/chrome/browser/views/frame/browser_frame_gtk.cc b/chrome/browser/views/frame/browser_frame_gtk.cc
index b7d9689..5b66885 100644
--- a/chrome/browser/views/frame/browser_frame_gtk.cc
+++ b/chrome/browser/views/frame/browser_frame_gtk.cc
@@ -12,50 +12,11 @@
#include "chrome/browser/views/frame/browser_root_view.h"
#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/frame/opaque_browser_frame_view.h"
+#include "chrome/browser/views/frame/popup_non_client_frame_view.h"
#include "gfx/font.h"
#include "views/widget/root_view.h"
#include "views/window/hit_test.h"
-namespace {
-
-// BrowserNonClientFrameView implementation for popups. We let the window
-// manager implementation render the decorations for popups, so this draws
-// nothing.
-class PopupNonClientFrameView : public BrowserNonClientFrameView {
- public:
- PopupNonClientFrameView() {
- }
-
- // NonClientFrameView:
- virtual gfx::Rect GetBoundsForClientView() const {
- return gfx::Rect(0, 0, width(), height());
- }
- virtual bool AlwaysUseCustomFrame() const { return false; }
- virtual bool AlwaysUseNativeFrame() const { return true; }
- virtual gfx::Rect GetWindowBoundsForClientBounds(
- const gfx::Rect& client_bounds) const {
- return client_bounds;
- }
- virtual int NonClientHitTest(const gfx::Point& point) {
- return bounds().Contains(point) ? HTCLIENT : HTNOWHERE;
- }
- virtual void GetWindowMask(const gfx::Size& size,
- gfx::Path* window_mask) {}
- virtual void EnableClose(bool enable) {}
- virtual void ResetWindowControls() {}
-
- // BrowserNonClientFrameView:
- virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const {
- return gfx::Rect(0, 0, width(), tabstrip->GetPreferredHeight());
- }
- virtual void UpdateThrobber(bool running) {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PopupNonClientFrameView);
-};
-
-}
-
#if !defined(OS_CHROMEOS)
// static (Factory method.)
BrowserFrame* BrowserFrame::Create(BrowserView* browser_view,
diff --git a/chrome/browser/views/frame/popup_non_client_frame_view.cc b/chrome/browser/views/frame/popup_non_client_frame_view.cc
new file mode 100644
index 0000000..5d16079
--- /dev/null
+++ b/chrome/browser/views/frame/popup_non_client_frame_view.cc
@@ -0,0 +1,54 @@
+// Copyright (c) 2010 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/views/frame/popup_non_client_frame_view.h"
+
+#include "base/logging.h"
+#include "chrome/browser/views/tabs/base_tab_strip.h"
+#include "gfx/point.h"
+#include "gfx/rect.h"
+#include "gfx/size.h"
+
+#if defined(OS_LINUX)
+#include "views/window/hit_test.h"
+#endif
+
+gfx::Rect PopupNonClientFrameView::GetBoundsForClientView() const {
+ return gfx::Rect(0, 0, width(), height());
+}
+
+bool PopupNonClientFrameView::AlwaysUseCustomFrame() const {
+ return false;
+}
+
+bool PopupNonClientFrameView::AlwaysUseNativeFrame() const {
+ return true;
+}
+
+gfx::Rect PopupNonClientFrameView::GetWindowBoundsForClientBounds(
+ const gfx::Rect& client_bounds) const {
+ return client_bounds;
+}
+
+int PopupNonClientFrameView::NonClientHitTest(const gfx::Point& point) {
+ return bounds().Contains(point) ? HTCLIENT : HTNOWHERE;
+}
+
+void PopupNonClientFrameView::GetWindowMask(const gfx::Size& size,
+ gfx::Path* window_mask) {
+}
+
+void PopupNonClientFrameView::EnableClose(bool enable) {
+}
+
+void PopupNonClientFrameView::ResetWindowControls() {
+}
+
+gfx::Rect PopupNonClientFrameView::GetBoundsForTabStrip(
+ BaseTabStrip* tabstrip) const {
+ return gfx::Rect(0, 0, width(), tabstrip->GetPreferredHeight());
+}
+
+void PopupNonClientFrameView::UpdateThrobber(bool running) {
+}
diff --git a/chrome/browser/views/frame/popup_non_client_frame_view.h b/chrome/browser/views/frame/popup_non_client_frame_view.h
new file mode 100644
index 0000000..e403bf3
--- /dev/null
+++ b/chrome/browser/views/frame/popup_non_client_frame_view.h
@@ -0,0 +1,39 @@
+// Copyright (c) 2009 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_VIEWS_FRAME_POPUP_NON_CLIENT_FRAME_VIEW_H_
+#define CHROME_BROWSER_VIEWS_FRAME_POPUP_NON_CLIENT_FRAME_VIEW_H_
+#pragma once
+
+#include "chrome/browser/views/frame/browser_non_client_frame_view.h"
+
+class BaseTabStrip;
+
+// BrowserNonClientFrameView implementation for popups. We let the window
+// manager implementation render the decorations for popups, so this draws
+// nothing.
+class PopupNonClientFrameView : public BrowserNonClientFrameView {
+ public:
+ PopupNonClientFrameView() {}
+
+ // NonClientFrameView:
+ virtual gfx::Rect GetBoundsForClientView() const;
+ virtual bool AlwaysUseCustomFrame() const;
+ virtual bool AlwaysUseNativeFrame() const;
+ virtual gfx::Rect GetWindowBoundsForClientBounds(
+ const gfx::Rect& client_bounds) const;
+ virtual int NonClientHitTest(const gfx::Point& point);
+ virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask);
+ virtual void EnableClose(bool enable);
+ virtual void ResetWindowControls();
+
+ // BrowserNonClientFrameView:
+ virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
+ virtual void UpdateThrobber(bool running);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PopupNonClientFrameView);
+};
+
+#endif // CHROME_BROWSER_VIEWS_FRAME_POPUP_NON_CLIENT_FRAME_VIEW_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 1113b99..8456a52 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2734,6 +2734,8 @@
'browser/views/frame/glass_browser_frame_view.h',
'browser/views/frame/opaque_browser_frame_view.cc',
'browser/views/frame/opaque_browser_frame_view.h',
+ 'browser/views/frame/popup_non_client_frame_view.cc',
+ 'browser/views/frame/popup_non_client_frame_view.h',
'browser/views/fullscreen_exit_bubble.cc',
'browser/views/fullscreen_exit_bubble.h',
'browser/views/generic_info_view.cc',
@@ -3421,6 +3423,8 @@
['include', '^browser/views/frame/browser_root_view.h'],
['include', '^browser/views/frame/opaque_browser_frame_view.cc'],
['include', '^browser/views/frame/opaque_browser_frame_view.h'],
+ ['include', '^browser/views/frame/popup_non_client_frame_view.cc'],
+ ['include', '^browser/views/frame/popup_non_client_frame_view.h'],
['include', '^browser/views/infobars/*'],
['include', '^browser/views/info_bubble.cc'],
['include', '^browser/views/info_bubble.h'],