summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-28 21:51:36 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-28 21:51:36 +0000
commitfe42b8c6c70c9d72bc0b2c0097c456ce5edffab0 (patch)
tree970911533783989edff0986563c19bdb30a326e9
parenta78286f3fe316afebdb55a6c107915c5ff464fbe (diff)
downloadchromium_src-fe42b8c6c70c9d72bc0b2c0097c456ce5edffab0.zip
chromium_src-fe42b8c6c70c9d72bc0b2c0097c456ce5edffab0.tar.gz
chromium_src-fe42b8c6c70c9d72bc0b2c0097c456ce5edffab0.tar.bz2
Support creating panel on windows. Also allow dragging panels to rearrange
positions. BUG=none TEST=Basic test in panel_browsertest Review URL: http://codereview.chromium.org/6897012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83415 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/panels/panel.cc17
-rw-r--r--chrome/browser/ui/panels/panel.h12
-rw-r--r--chrome/browser/ui/panels/panel_browser_frame_view.cc34
-rw-r--r--chrome/browser/ui/panels/panel_browser_frame_view.h33
-rw-r--r--chrome/browser/ui/panels/panel_browser_view.cc71
-rw-r--r--chrome/browser/ui/panels/panel_browser_view.h48
-rw-r--r--chrome/browser/ui/panels/panel_browsertest.cc33
-rw-r--r--chrome/browser/ui/panels/panel_manager.cc45
-rw-r--r--chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_win.cc11
-rw-r--r--chrome/chrome_browser.gypi10
-rw-r--r--chrome/chrome_tests.gypi1
-rw-r--r--views/events/event_win.cc33
12 files changed, 306 insertions, 42 deletions
diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc
index 3b37a43..c9dcfc5 100644
--- a/chrome/browser/ui/panels/panel.cc
+++ b/chrome/browser/ui/panels/panel.cc
@@ -23,6 +23,13 @@ PanelManager* Panel::manager() const {
return PanelManager::GetInstance();
}
+void Panel::SetPanelBounds(const gfx::Rect& bounds) {
+ if (bounds_ == bounds)
+ return;
+ bounds_ = bounds;
+ browser_window_->SetBounds(bounds);
+}
+
void Panel::Minimize() {
NOTIMPLEMENTED();
}
@@ -40,7 +47,8 @@ void Panel::ShowInactive() {
}
void Panel::SetBounds(const gfx::Rect& bounds) {
- NOTIMPLEMENTED();
+ // Ignore any SetBounds requests since the bounds are completely controlled
+ // by panel manager.
}
void Panel::Close() {
@@ -106,13 +114,11 @@ void Panel::SetStarredState(bool is_starred) {
}
gfx::Rect Panel::GetRestoredBounds() const {
- NOTIMPLEMENTED();
- return gfx::Rect();
+ return bounds_;
}
gfx::Rect Panel::GetBounds() const {
- NOTIMPLEMENTED();
- return gfx::Rect();
+ return minimized_ ? minimized_bounds_ : bounds_;
}
bool Panel::IsMaximized() const {
@@ -125,7 +131,6 @@ void Panel::SetFullscreen(bool fullscreen) {
}
bool Panel::IsFullscreen() const {
- NOTIMPLEMENTED();
return false;
}
diff --git a/chrome/browser/ui/panels/panel.h b/chrome/browser/ui/panels/panel.h
index e56427f..41b835d 100644
--- a/chrome/browser/ui/panels/panel.h
+++ b/chrome/browser/ui/panels/panel.h
@@ -34,8 +34,6 @@ class Panel : public BrowserWindow {
void Restore();
- const gfx::Rect& bounds() const { return bounds_; }
-
bool minimized() const { return minimized_; }
// BrowserWindow overrides.
@@ -142,12 +140,22 @@ class Panel : public BrowserWindow {
// Panel can only be created using PanelManager::CreatePanel().
Panel(Browser* browser, const gfx::Rect& bounds);
+ // This is different from BrowserWindow::SetBounds():
+ // * SetPanelBounds() is only called by PanelManager to manage its position.
+ // * SetBounds() is called by the API to try to change the bounds, which is
+ // not allowed for Panel.
+ void SetPanelBounds(const gfx::Rect& bounds);
+
// Platform specifc BrowserWindow implementation for panels. It'd be one of
// PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa.
scoped_ptr<BrowserWindow> browser_window_;
+ // The normal bounds when the panel is not minimized.
gfx::Rect bounds_;
+ // The bounds when the panel is minimized.
+ gfx::Rect minimized_bounds_;
+
// Is the panel minimized?
bool minimized_;
diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc
new file mode 100644
index 0000000..c561e44
--- /dev/null
+++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc
@@ -0,0 +1,34 @@
+// 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/panels/panel_browser_frame_view.h"
+
+#include "chrome/browser/ui/panels/panel_browser_view.h"
+
+PanelBrowserFrameView::PanelBrowserFrameView(BrowserFrame* frame,
+ PanelBrowserView* browser_view)
+ : OpaqueBrowserFrameView(frame, browser_view),
+ browser_view_(browser_view) {
+}
+
+PanelBrowserFrameView::~PanelBrowserFrameView() {
+}
+
+bool PanelBrowserFrameView::OnMousePressed(const views::MouseEvent& event) {
+ if (browser_view_->OnTitleBarMousePressed(event))
+ return true;
+ return OpaqueBrowserFrameView::OnMousePressed(event);
+}
+
+bool PanelBrowserFrameView::OnMouseDragged(const views::MouseEvent& event) {
+ if (browser_view_->OnTitleBarMouseDragged(event))
+ return true;
+ return OpaqueBrowserFrameView::OnMouseDragged(event);
+}
+
+void PanelBrowserFrameView::OnMouseReleased(const views::MouseEvent& event) {
+ if (browser_view_->OnTitleBarMouseReleased(event))
+ return;
+ OpaqueBrowserFrameView::OnMouseReleased(event);
+}
diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.h b/chrome/browser/ui/panels/panel_browser_frame_view.h
new file mode 100644
index 0000000..c0ab797
--- /dev/null
+++ b/chrome/browser/ui/panels/panel_browser_frame_view.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_PANELS_PANEL_BROWSER_FRAME_VIEW_H_
+#define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_FRAME_VIEW_H_
+#pragma once
+
+#include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
+
+class PanelBrowserView;
+
+class PanelBrowserFrameView : public OpaqueBrowserFrameView {
+ public:
+ PanelBrowserFrameView(BrowserFrame* frame, PanelBrowserView* browser_view);
+ virtual ~PanelBrowserFrameView();
+
+ protected:
+ // Overridden from views::View:
+ virtual bool OnMousePressed(const views::MouseEvent& event);
+ virtual bool OnMouseDragged(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event);
+
+ private:
+ // The client view hosted within this non-client frame view that is
+ // guaranteed to be freed before the client view.
+ // (see comments about view hierarchies in non_client_view.h)
+ PanelBrowserView* browser_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(PanelBrowserFrameView);
+};
+
+#endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_FRAME_VIEW_H_
diff --git a/chrome/browser/ui/panels/panel_browser_view.cc b/chrome/browser/ui/panels/panel_browser_view.cc
index 8bbb0d8..65bf737 100644
--- a/chrome/browser/ui/panels/panel_browser_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_view.cc
@@ -2,10 +2,77 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/panels/panel_browser_view.h"
+
#include "base/logging.h"
#include "chrome/browser/ui/panels/panel.h"
+#include "chrome/browser/ui/panels/panel_manager.h"
+#include "grit/chromium_strings.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "views/window/window.h"
BrowserWindow* Panel::CreateNativePanel(Browser* browser, Panel* panel) {
- NOTIMPLEMENTED();
- return NULL;
+ BrowserView* view = new PanelBrowserView(browser, panel);
+ BrowserFrame::Create(view, browser->profile());
+ view->GetWindow()->non_client_view()->SetAccessibleName(
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
+ return view;
+}
+
+PanelBrowserView::PanelBrowserView(Browser* browser, Panel* panel)
+ : BrowserView(browser),
+ panel_(panel),
+ mouse_pressed_(false),
+ mouse_dragging_(false) {
+}
+
+PanelBrowserView::~PanelBrowserView() {
+}
+
+void PanelBrowserView::Close() {
+ if (!panel_)
+ return;
+ ::BrowserView::Close();
+ panel_ = NULL;
+}
+
+bool PanelBrowserView::GetSavedWindowBounds(gfx::Rect* bounds) const {
+ *bounds = panel_->GetRestoredBounds();
+ return true;
+}
+
+bool PanelBrowserView::OnTitleBarMousePressed(const views::MouseEvent& event) {
+ if (!event.IsOnlyLeftMouseButton())
+ return false;
+ mouse_pressed_ = true;
+ mouse_pressed_point_ = event.location();
+ mouse_dragging_ = false;
+ panel_->manager()->StartDragging(panel_);
+ return true;
+}
+
+bool PanelBrowserView::OnTitleBarMouseDragged(const views::MouseEvent& event) {
+ if (!mouse_pressed_)
+ return false;
+
+ // We do not allow dragging vertically.
+ int delta_x = event.location().x() - mouse_pressed_point_.x();
+ if (!mouse_dragging_ && ExceededDragThreshold(delta_x, 0))
+ mouse_dragging_ = true;
+ if (mouse_dragging_)
+ panel_->manager()->Drag(delta_x);
+ return true;
+}
+
+bool PanelBrowserView::OnTitleBarMouseReleased(const views::MouseEvent& event) {
+ // Only handle clicks that started in our window.
+ if (!mouse_pressed_)
+ return false;
+ mouse_pressed_ = false;
+
+ if (mouse_dragging_) {
+ mouse_dragging_ = false;
+ panel_->manager()->EndDragging(false);
+ }
+ return true;
}
diff --git a/chrome/browser/ui/panels/panel_browser_view.h b/chrome/browser/ui/panels/panel_browser_view.h
new file mode 100644
index 0000000..2426cd3
--- /dev/null
+++ b/chrome/browser/ui/panels/panel_browser_view.h
@@ -0,0 +1,48 @@
+// 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_PANELS_PANEL_BROWSER_VIEW_H_
+#define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_
+#pragma once
+
+#include "chrome/browser/ui/views/frame/browser_view.h"
+
+class Browser;
+class Panel;
+
+// A browser view that implements Panel specific behavior.
+class PanelBrowserView : public ::BrowserView {
+ public:
+ PanelBrowserView(Browser* browser, Panel* panel);
+ virtual ~PanelBrowserView();
+
+ Panel* panel() const { return panel_; }
+
+ // Called from frame view when title bar receives a mouse event.
+ // Return true if the event is handled.
+ bool OnTitleBarMousePressed(const views::MouseEvent& event);
+ bool OnTitleBarMouseDragged(const views::MouseEvent& event);
+ bool OnTitleBarMouseReleased(const views::MouseEvent& event);
+
+ // Overridden from BrowserView:
+ virtual void Close();
+ virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const;
+
+ private:
+ Panel* panel_;
+
+ // Is the mouse button currently down?
+ bool mouse_pressed_;
+
+ // Location the mouse was pressed at. Used to detect drag and drop.
+ gfx::Point mouse_pressed_point_;
+
+ // Is the titlebar currently being dragged? That is, has the cursor
+ // moved more than kDragThreshold away from its starting position?
+ bool mouse_dragging_;
+
+ DISALLOW_COPY_AND_ASSIGN(PanelBrowserView);
+};
+
+#endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_
diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc
new file mode 100644
index 0000000..58647a5
--- /dev/null
+++ b/chrome/browser/ui/panels/panel_browsertest.cc
@@ -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.
+
+#include "base/command_line.h"
+#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_window.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/test/in_process_browser_test.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class PanelBrowserTest : public InProcessBrowserTest {
+ public:
+ PanelBrowserTest() : InProcessBrowserTest() { }
+
+ virtual void SetUpCommandLine(CommandLine* command_line) {
+ command_line->AppendSwitch(switches::kEnablePanels);
+ }
+};
+
+// Panel is now only supported on windows.
+#if defined(OS_WIN)
+IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreatePanel) {
+ Browser* panel = Browser::CreateForApp("", gfx::Size(),
+ browser()->profile(), true);
+ EXPECT_EQ(Browser::TYPE_APP_PANEL, panel->type());
+ panel->window()->Show();
+ panel->window()->Close();
+}
+#endif
diff --git a/chrome/browser/ui/panels/panel_manager.cc b/chrome/browser/ui/panels/panel_manager.cc
index d78f84b..e6aea4d 100644
--- a/chrome/browser/ui/panels/panel_manager.cc
+++ b/chrome/browser/ui/panels/panel_manager.cc
@@ -90,7 +90,7 @@ Panel* PanelManager::CreatePanel(Browser* browser) {
void PanelManager::ProcessPending() {
while (!pending_panels_.empty()) {
Panel* panel = pending_panels_.front();
- gfx::Rect bounds = panel->bounds();
+ gfx::Rect bounds = panel->GetRestoredBounds();
if (ComputeBoundsForNextPanel(&bounds, true)) {
// TODO(jianli): More work to support displaying pending panels.
active_panels_.push_back(panel);
@@ -128,7 +128,8 @@ void PanelManager::DoRemove(Panel* panel) {
return;
}
- current_x_ = (*iter)->bounds().x() + (*iter)->bounds().width();
+ gfx::Rect bounds = (*iter)->GetRestoredBounds();
+ current_x_ = bounds.x() + bounds.width();
Rearrange(active_panels_.erase(iter));
ProcessPending();
@@ -138,7 +139,7 @@ void PanelManager::StartDragging(Panel* panel) {
for (size_t i = 0; i < active_panels_.size(); ++i) {
if (active_panels_[i] == panel) {
dragging_panel_index_ = i;
- dragging_panel_bounds_ = panel->bounds();
+ dragging_panel_bounds_ = panel->GetRestoredBounds();
dragging_panel_original_x_ = dragging_panel_bounds_.x();
break;
}
@@ -152,9 +153,10 @@ void PanelManager::Drag(int delta_x) {
return;
// Moves this panel to the dragging position.
- gfx::Rect new_bounds(active_panels_[dragging_panel_index_]->bounds());
+ gfx::Rect new_bounds(
+ active_panels_[dragging_panel_index_]->GetRestoredBounds());
new_bounds.set_x(new_bounds.x() + delta_x);
- active_panels_[dragging_panel_index_]->SetBounds(new_bounds);
+ active_panels_[dragging_panel_index_]->SetPanelBounds(new_bounds);
// Checks and processes other affected panels.
if (delta_x > 0)
@@ -170,7 +172,7 @@ void PanelManager::DragNegative(int delta_x) {
// This is the left corner of the dragging panel. We use it to check against
// all the panels on its left.
- int dragging_panel_x = dragging_panel->bounds().x() + delta_x;
+ int dragging_panel_x = dragging_panel->GetRestoredBounds().x() + delta_x;
// This is the right corner which a panel will be moved to.
int right_x_to_move_to =
@@ -182,15 +184,15 @@ void PanelManager::DragNegative(int delta_x) {
for (; j < active_panels_.size(); ++j, ++i) {
// Current panel will only be affected if the left corner of dragging
// panel goes beyond the middle position of the current panel.
- if (dragging_panel_x > active_panels_[j]->bounds().x() +
- active_panels_[j]->bounds().width() / 2)
+ if (dragging_panel_x > active_panels_[j]->GetRestoredBounds().x() +
+ active_panels_[j]->GetRestoredBounds().width() / 2)
break;
// Moves current panel to the new position.
- gfx::Rect bounds(active_panels_[j]->bounds());
+ gfx::Rect bounds(active_panels_[j]->GetRestoredBounds());
bounds.set_x(right_x_to_move_to - bounds.width());
right_x_to_move_to -= bounds.width() + kPanelsHorizontalSpacing;
- active_panels_[j]->SetBounds(bounds);
+ active_panels_[j]->SetPanelBounds(bounds);
// Adjusts the index of current panel.
active_panels_[i] = active_panels_[j];
@@ -214,8 +216,8 @@ void PanelManager::DragPositive(int delta_x) {
// This is the right corner of the dragging panel. We use it to check against
// all the panels on its right.
- int dragging_panel_x = dragging_panel->bounds().x() +
- dragging_panel->bounds().width() - 1 + delta_x;
+ int dragging_panel_x = dragging_panel->GetRestoredBounds().x() +
+ dragging_panel->GetRestoredBounds().width() - 1 + delta_x;
// This is the left corner which a panel will be moved to.
int left_x_to_move_to = dragging_panel_bounds_.x();
@@ -226,15 +228,15 @@ void PanelManager::DragPositive(int delta_x) {
for (; j >= 0; --j, --i) {
// Current panel will only be affected if the right corner of dragging
// panel goes beyond the middle position of the current panel.
- if (dragging_panel_x < active_panels_[j]->bounds().x() +
- active_panels_[j]->bounds().width() / 2)
+ if (dragging_panel_x < active_panels_[j]->GetRestoredBounds().x() +
+ active_panels_[j]->GetRestoredBounds().width() / 2)
break;
// Moves current panel to the new position.
- gfx::Rect bounds(active_panels_[j]->bounds());
+ gfx::Rect bounds(active_panels_[j]->GetRestoredBounds());
bounds.set_x(left_x_to_move_to);
left_x_to_move_to += bounds.width() + kPanelsHorizontalSpacing;
- active_panels_[j]->SetBounds(bounds);
+ active_panels_[j]->SetPanelBounds(bounds);
// Adjusts the index of current panel.
active_panels_[i] = active_panels_[j];
@@ -255,9 +257,10 @@ void PanelManager::EndDragging(bool cancelled) {
if (cancelled) {
Drag(dragging_panel_original_x_ -
- active_panels_[dragging_panel_index_]->bounds().x());
+ active_panels_[dragging_panel_index_]->GetRestoredBounds().x());
} else {
- active_panels_[dragging_panel_index_]->SetBounds(dragging_panel_bounds_);
+ active_panels_[dragging_panel_index_]->SetPanelBounds(
+ dragging_panel_bounds_);
}
dragging_panel_index_ = kInvalidPanelIndex;
@@ -271,10 +274,10 @@ void PanelManager::Rearrange(ActivePanels::iterator iter_to_start) {
for (ActivePanels::iterator iter = iter_to_start;
iter != active_panels_.end(); ++iter) {
- gfx::Rect new_bounds((*iter)->bounds());
+ gfx::Rect new_bounds((*iter)->GetRestoredBounds());
ComputeBoundsForNextPanel(&new_bounds, false);
- if (new_bounds != (*iter)->bounds())
- (*iter)->SetBounds(new_bounds);
+ if (new_bounds != (*iter)->GetRestoredBounds())
+ (*iter)->SetPanelBounds(new_bounds);
}
}
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_win.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_win.cc
index 5eaf7fd..3740087 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_win.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_win.cc
@@ -4,7 +4,8 @@
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
-#include "chrome/browser/ui/views/frame/app_panel_browser_frame_view.h"
+#include "chrome/browser/ui/panels/panel_browser_frame_view.h"
+#include "chrome/browser/ui/panels/panel_browser_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
@@ -12,10 +13,12 @@ namespace browser {
BrowserNonClientFrameView* CreateBrowserNonClientFrameView(
BrowserFrame* frame, BrowserView* browser_view) {
- if (browser_view->IsBrowserTypePanel())
- return new AppPanelBrowserFrameView(frame, browser_view);
- else
+ if (browser_view->IsBrowserTypePanel()) {
+ return new PanelBrowserFrameView(
+ frame, static_cast<PanelBrowserView*>(browser_view));
+ } else {
return new OpaqueBrowserFrameView(frame, browser_view);
+ }
}
} // browser
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 243c313..ae8e1e2 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2775,9 +2775,12 @@
'browser/ui/options/options_util.h',
'browser/ui/panels/panel.cc',
'browser/ui/panels/panel.h',
+ 'browser/ui/panels/panel_browser_frame_view.cc',
+ 'browser/ui/panels/panel_browser_frame_view.h',
'browser/ui/panels/panel_browser_window_cocoa.mm',
'browser/ui/panels/panel_browser_window_gtk.cc',
'browser/ui/panels/panel_browser_view.cc',
+ 'browser/ui/panels/panel_browser_view.h',
'browser/ui/panels/panel_manager.cc',
'browser/ui/panels/panel_manager.h',
'browser/ui/profile_error_dialog.cc',
@@ -3627,6 +3630,10 @@
'browser/ui/tabs/dock_info.cc',
'browser/ui/views/extensions/extension_view.cc',
'browser/ui/views/extensions/extension_view.h',
+ 'browser/ui/panels/panel_browser_frame_view.cc',
+ 'browser/ui/panels/panel_browser_frame_view.h',
+ 'browser/ui/panels/panel_browser_view.cc',
+ 'browser/ui/panels/panel_browser_view.h',
],
'sources': [
# Build Apple sample code
@@ -4191,7 +4198,10 @@
['exclude', '^browser/ui/browser_list_stub.cc'],
['exclude', '^browser/ui/views/autocomplete/autocomplete_popup_gtk.cc'],
['exclude', '^browser/ui/views/autocomplete/autocomplete_popup_gtk.h'],
+ ['exclude', '^browser/ui/panels/panel_browser_frame_view.cc'],
+ ['exclude', '^browser/ui/panels/panel_browser_frame_view.h'],
['exclude', '^browser/ui/panels/panel_browser_view.cc'],
+ ['exclude', '^browser/ui/panels/panel_browser_view.h'],
],
}],
# Touch build only
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 000a3b3..a0f6af2 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -2367,6 +2367,7 @@
'browser/ui/cocoa/applescript/window_applescript_test.mm',
'browser/ui/find_bar/find_bar_host_browsertest.cc',
'browser/ui/login/login_prompt_browsertest.cc',
+ 'browser/ui/panels/panel_browsertest.cc',
'browser/ui/views/browser_actions_container_browsertest.cc',
'browser/ui/views/dom_view_browsertest.cc',
'browser/ui/views/html_dialog_view_browsertest.cc',
diff --git a/views/events/event_win.cc b/views/events/event_win.cc
index cd1d715..2fb691e 100644
--- a/views/events/event_win.cc
+++ b/views/events/event_win.cc
@@ -134,13 +134,32 @@ int EventFlagsFromNative(NativeEvent native_event) {
break;
}
- UINT win_flags = GET_KEYSTATE_WPARAM(native_event.wParam);
- flags |= (win_flags & MK_CONTROL) ? ui::EF_CONTROL_DOWN : 0;
- flags |= (win_flags & MK_SHIFT) ? ui::EF_SHIFT_DOWN : 0;
- flags |= (GetKeyState(VK_MENU) < 0) ? ui::EF_ALT_DOWN : 0;
- flags |= (win_flags & MK_LBUTTON) ? ui::EF_LEFT_BUTTON_DOWN : 0;
- flags |= (win_flags & MK_MBUTTON) ? ui::EF_MIDDLE_BUTTON_DOWN : 0;
- flags |= (win_flags & MK_RBUTTON) ? ui::EF_RIGHT_BUTTON_DOWN : 0;
+ // For non-client mouse message, the WPARAM value represents the hit test
+ // result, instead of the key state.
+ switch (native_event.message) {
+ case WM_NCLBUTTONDOWN:
+ case WM_NCLBUTTONUP:
+ flags |= ui::EF_LEFT_BUTTON_DOWN;
+ break;
+ case WM_NCMBUTTONDOWN:
+ case WM_NCMBUTTONUP:
+ flags |= ui::EF_MIDDLE_BUTTON_DOWN;
+ break;
+ case WM_NCRBUTTONDOWN:
+ case WM_NCRBUTTONUP:
+ flags |= ui::EF_RIGHT_BUTTON_DOWN;
+ break;
+ default: {
+ UINT win_flags = GET_KEYSTATE_WPARAM(native_event.wParam);
+ flags |= (win_flags & MK_CONTROL) ? ui::EF_CONTROL_DOWN : 0;
+ flags |= (win_flags & MK_SHIFT) ? ui::EF_SHIFT_DOWN : 0;
+ flags |= (GetKeyState(VK_MENU) < 0) ? ui::EF_ALT_DOWN : 0;
+ flags |= (win_flags & MK_LBUTTON) ? ui::EF_LEFT_BUTTON_DOWN : 0;
+ flags |= (win_flags & MK_MBUTTON) ? ui::EF_MIDDLE_BUTTON_DOWN : 0;
+ flags |= (win_flags & MK_RBUTTON) ? ui::EF_RIGHT_BUTTON_DOWN : 0;
+ break;
+ }
+ }
return flags;
}