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

Unified Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 10388156: Adding the flip windows button to the browser window (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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/views/frame/browser_view.cc
===================================================================
--- chrome/browser/ui/views/frame/browser_view.cc (revision 136912)
+++ chrome/browser/ui/views/frame/browser_view.cc (working copy)
@@ -159,6 +159,13 @@
// How round the 'new tab' style bookmarks bar is.
const int kNewtabBarRoundness = 5;
+#if !defined(USE_AURA)
+extern "C" {
+// Metro export for switching chrome windows.
+typedef void (*FlipFrameWindows)();
+}
+#endif
+
} // namespace
// Returned from BrowserView::GetClassName.
@@ -305,6 +312,7 @@
active_bookmark_bar_(NULL),
tabstrip_(NULL),
toolbar_(NULL),
+ window_switcher_button_(NULL),
infobar_container_(NULL),
contents_container_(NULL),
devtools_container_(NULL),
@@ -1686,6 +1694,7 @@
void BrowserView::Layout() {
if (ignore_layout_)
return;
+
views::View::Layout();
// The status bubble position requires that all other layout finish first.
@@ -1752,6 +1761,18 @@
return false;
}
+void BrowserView::ButtonPressed(views::Button* sender,
sky 2012/05/16 04:31:37 Can you move all of this code, save window_switche
+ const views::Event& event) {
+ if (sender != window_switcher_button_)
+ return;
+ // Tellt the metro_driver to flip our window. This causes the current
+ // browser window to be hidden and the next window to be shown.
+ static FlipFrameWindows flip_window_fn = reinterpret_cast<FlipFrameWindows>(
+ ::GetProcAddress(base::win::GetMetroModule(), "FlipFrameWindows"));
+ if (flip_window_fn)
+ flip_window_fn();
+}
+
void BrowserView::OnSysColorChange() {
InvertBubble::MaybeShowInvertBubble(browser_->profile(), contents_);
}
@@ -1794,6 +1815,21 @@
AddChildView(tabstrip_);
tabstrip_controller->InitFromModel(tabstrip_);
+ if (!base::win::GetMetroModule()) {
+ window_switcher_button_ = new views::ImageButton(this);
+ window_switcher_button_->SetImage(
+ views::ImageButton::BS_NORMAL,
+ ui::ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_PAGEINFO_WARNING_MINOR));
cpu_(ooo_6.6-7.5) 2012/05/16 01:31:37 the asset is a placeholder
+ window_switcher_button_->SetImageAlignment(
+ views::ImageButton::ALIGN_CENTER,
+ views::ImageButton::ALIGN_MIDDLE);
+ gfx::Size ps = window_switcher_button_->GetPreferredSize();
+ window_switcher_button_->SetBounds(0,0, ps.width(), ps.height());
+ window_switcher_button_->SetVisible(true);
+ AddChildView(window_switcher_button_);
+ }
+
SetToolbar(CreateToolbar());
infobar_container_ = new InfoBarContainerView(this);

Powered by Google App Engine
This is Rietveld 408576698