Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Unified Diff: chrome/browser/ui/panels/panel_browser_view.cc

Issue 8183005: Choose the right window to switch to when a panel is deactivated on Windows. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/panels/panel_browser_view.cc
===================================================================
--- chrome/browser/ui/panels/panel_browser_view.cc (revision 104349)
+++ chrome/browser/ui/panels/panel_browser_view.cc (working copy)
@@ -75,6 +75,28 @@
::BrowserView::Close();
}
+void PanelBrowserView::Deactivate() {
+ if (!IsActive())
+ return;
+
+#if defined(OS_WIN)
+ gfx::NativeWindow native_window = NULL;
+ BrowserWindow* browser_window =
+ panel_->manager()->GetNextBrowserWindowToActivate(panel_.get());
+ if (browser_window)
+ native_window = browser_window->GetNativeHandle();
+ else
+ native_window = ::GetDesktopWindow();
+ if (native_window)
+ ::SetForegroundWindow(native_window);
+ else
+ ::SetFocus(NULL);
+#else
+ // TODO(jianli): to be implemented for other platform.
+ BrowserView::Deactivate();
+#endif
+}
+
bool PanelBrowserView::CanResize() const {
return false;
}
@@ -449,8 +471,8 @@
virtual void CancelDragTitlebar() OVERRIDE;
virtual void FinishDragTitlebar() OVERRIDE;
virtual bool VerifyDrawingAttention() const OVERRIDE;
+ virtual bool VerifyActiveState(bool is_active) OVERRIDE;
-
PanelBrowserView* panel_browser_view_;
};
@@ -497,3 +519,16 @@
PanelBrowserFrameView::PAINT_FOR_ATTENTION);
return attention_color == frame_view->title_label_->GetColor();
}
+
+bool NativePanelTestingWin::VerifyActiveState(bool is_active) {
+ PanelBrowserFrameView* frame_view = panel_browser_view_->GetFrameView();
+
+ PanelBrowserFrameView::PaintState expected_paint_state =
+ is_active ? PanelBrowserFrameView::PAINT_AS_ACTIVE
+ : PanelBrowserFrameView::PAINT_AS_INACTIVE;
+ if (frame_view->paint_state_ != expected_paint_state)
+ return false;
+
+ SkColor expected_color = frame_view->GetTitleColor(expected_paint_state);
+ return expected_color == frame_view->title_label_->GetColor();
+}
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_view.h ('k') | chrome/browser/ui/panels/panel_browser_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698