diff options
author | prasadt@chromium.org <prasadt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-18 22:22:10 +0000 |
---|---|---|
committer | prasadt@chromium.org <prasadt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-18 22:22:10 +0000 |
commit | 42e94a0aed27f6e707b0a149cc67397b363a55c1 (patch) | |
tree | dd87d07e528bd9dc5182ee45b19297e7bcbc302f /chrome | |
parent | cc7ac8be0d6c00f8889ec1122c7b1972348c17c8 (diff) | |
download | chromium_src-42e94a0aed27f6e707b0a149cc67397b363a55c1.zip chromium_src-42e94a0aed27f6e707b0a149cc67397b363a55c1.tar.gz chromium_src-42e94a0aed27f6e707b0a149cc67397b363a55c1.tar.bz2 |
Do not show wrench menu on popups in aura.
In aura/chromeos, popups are shown in panels. We don't want to show the wrench
menu in this case.
BUG=109189
TEST=Open a small popup in aura/chromeos. Ensure no wrench menu.
Review URL: http://codereview.chromium.org/9211019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118168 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/ui/panels/panel_browser_frame_view.cc | 25 | ||||
-rw-r--r-- | chrome/browser/ui/panels/panel_browser_frame_view.h | 6 |
2 files changed, 27 insertions, 4 deletions
diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc index fcec968..9e92767 100644 --- a/chrome/browser/ui/panels/panel_browser_frame_view.cc +++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc @@ -330,7 +330,12 @@ PanelBrowserFrameView::PanelBrowserFrameView(BrowserFrame* frame, close_button_(NULL), title_icon_(NULL), title_label_(NULL), - is_settings_button_visible_(false) { + is_settings_button_visible_(false), +#if defined(USE_AURA) + has_settings_button_(panel_browser_view_->panel()->browser()->is_app()) { +#else + has_settings_button_(true) { +#endif frame->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); const ButtonResources& settings_button_resources = @@ -372,7 +377,8 @@ PanelBrowserFrameView::PanelBrowserFrameView(BrowserFrame* frame, title_label_->SetAutoColorReadabilityEnabled(false); AddChildView(title_label_); - mouse_watcher_.reset(new MouseWatcher(this)); + if (has_settings_button_) + mouse_watcher_.reset(new MouseWatcher(this)); } PanelBrowserFrameView::~PanelBrowserFrameView() { @@ -497,6 +503,10 @@ void PanelBrowserFrameView::Layout() { show_settings_button = false; } } + + if (!has_settings_button_) + show_settings_button = false; + close_button_->SetVisible(show_close_button); settings_button_->SetVisible(show_settings_button); title_label_->SetVisible(show_title_label); @@ -830,6 +840,9 @@ void PanelBrowserFrameView::UpdateTitleBar() { } void PanelBrowserFrameView::OnFocusChanged(bool focused) { + if (!has_settings_button_) + return; + UpdateSettingsButtonVisibility(focused, mouse_watcher_->IsCursorInViewBounds()); SchedulePaint(); @@ -839,12 +852,18 @@ void PanelBrowserFrameView::OnMouseEnterOrLeaveWindow(bool mouse_entered) { // Panel might be closed when we still watch the mouse event. if (!panel_browser_view_->panel()) return; + + if (!has_settings_button_) + return; + UpdateSettingsButtonVisibility(panel_browser_view_->focused(), mouse_entered); } void PanelBrowserFrameView::UpdateSettingsButtonVisibility( bool focused, bool cursor_in_view) { + DCHECK(has_settings_button_); + // The settings button is not shown in the overflow state. if (panel_browser_view_->panel()->expansion_state() == Panel::IN_OVERFLOW) return; @@ -854,7 +873,7 @@ void PanelBrowserFrameView::UpdateSettingsButtonVisibility( return; is_settings_button_visible_ = is_settings_button_visible; - // Even if we're hidng the settings button, we still make it visible for the + // Even if we're hiding the settings button, we still make it visible for the // time period that the animation is running. settings_button_->SetVisible(true); diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.h b/chrome/browser/ui/panels/panel_browser_frame_view.h index 052b4fd..d80e9e9 100644 --- a/chrome/browser/ui/panels/panel_browser_frame_view.h +++ b/chrome/browser/ui/panels/panel_browser_frame_view.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -205,6 +205,10 @@ class PanelBrowserFrameView : public BrowserNonClientFrameView, gfx::Rect settings_button_zero_bounds_; bool is_settings_button_visible_; + // On Aura popups are displayed in panels. If this panel is not opened by an + // app, it won't have a settings button. + const bool has_settings_button_; + DISALLOW_COPY_AND_ASSIGN(PanelBrowserFrameView); }; |