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

Side by Side Diff: chrome/browser/ui/panels/panel_browser_frame_view.cc

Issue 9195003: Move IN_OVERFLOW from Panel::ExpansionState to new enum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" 5 #include "chrome/browser/ui/panels/panel_browser_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/themes/theme_service.h" 10 #include "chrome/browser/themes/theme_service.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 // the minimum size. 481 // the minimum size.
482 return gfx::Size(); 482 return gfx::Size();
483 } 483 }
484 484
485 void PanelBrowserFrameView::Layout() { 485 void PanelBrowserFrameView::Layout() {
486 // Check if the width is only enough to show only the icon, or both icon 486 // Check if the width is only enough to show only the icon, or both icon
487 // and title. Hide corresponding controls accordingly. 487 // and title. Hide corresponding controls accordingly.
488 bool show_close_button = true; 488 bool show_close_button = true;
489 bool show_settings_button = true; 489 bool show_settings_button = true;
490 bool show_title_label = true; 490 bool show_title_label = true;
491 if (panel_browser_view_->panel()->expansion_state() == Panel::IN_OVERFLOW) { 491 if (panel_browser_view_->panel()->strip_owner() == Panel::IN_OVERFLOW) {
492 if (width() <= IconOnlyWidth()) { 492 if (width() <= IconOnlyWidth()) {
493 show_close_button = false; 493 show_close_button = false;
494 show_settings_button = false; 494 show_settings_button = false;
495 show_title_label = false; 495 show_title_label = false;
496 } else { 496 } else {
497 show_settings_button = false; 497 show_settings_button = false;
498 } 498 }
499 } 499 }
500 close_button_->SetVisible(show_close_button); 500 close_button_->SetVisible(show_close_button);
501 settings_button_->SetVisible(show_settings_button); 501 settings_button_->SetVisible(show_settings_button);
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 // Panel might be closed when we still watch the mouse event. 839 // Panel might be closed when we still watch the mouse event.
840 if (!panel_browser_view_->panel()) 840 if (!panel_browser_view_->panel())
841 return; 841 return;
842 UpdateSettingsButtonVisibility(panel_browser_view_->focused(), 842 UpdateSettingsButtonVisibility(panel_browser_view_->focused(),
843 mouse_entered); 843 mouse_entered);
844 } 844 }
845 845
846 void PanelBrowserFrameView::UpdateSettingsButtonVisibility( 846 void PanelBrowserFrameView::UpdateSettingsButtonVisibility(
847 bool focused, bool cursor_in_view) { 847 bool focused, bool cursor_in_view) {
848 // The settings button is not shown in the overflow state. 848 // The settings button is not shown in the overflow state.
849 if (panel_browser_view_->panel()->expansion_state() == Panel::IN_OVERFLOW) 849 if (panel_browser_view_->panel()->strip_owner() == Panel::IN_OVERFLOW)
850 return; 850 return;
851 851
852 bool is_settings_button_visible = focused || cursor_in_view; 852 bool is_settings_button_visible = focused || cursor_in_view;
853 if (is_settings_button_visible_ == is_settings_button_visible) 853 if (is_settings_button_visible_ == is_settings_button_visible)
854 return; 854 return;
855 is_settings_button_visible_ = is_settings_button_visible; 855 is_settings_button_visible_ = is_settings_button_visible;
856 856
857 // Even if we're hidng the settings button, we still make it visible for the 857 // Even if we're hidng the settings button, we still make it visible for the
858 // time period that the animation is running. 858 // time period that the animation is running.
859 settings_button_->SetVisible(true); 859 settings_button_->SetVisible(true);
(...skipping 20 matching lines...) Expand all
880 880
881 settings_menu_model_.reset( 881 settings_menu_model_.reset(
882 new PanelSettingsMenuModel(panel_browser_view_->panel())); 882 new PanelSettingsMenuModel(panel_browser_view_->panel()));
883 settings_menu_adapter_.reset( 883 settings_menu_adapter_.reset(
884 new views::MenuModelAdapter(settings_menu_model_.get())); 884 new views::MenuModelAdapter(settings_menu_model_.get()));
885 settings_menu_ = new views::MenuItemView(settings_menu_adapter_.get()); 885 settings_menu_ = new views::MenuItemView(settings_menu_adapter_.get());
886 settings_menu_adapter_->BuildMenu(settings_menu_); 886 settings_menu_adapter_->BuildMenu(settings_menu_);
887 settings_menu_runner_.reset(new views::MenuRunner(settings_menu_)); 887 settings_menu_runner_.reset(new views::MenuRunner(settings_menu_));
888 return true; 888 return true;
889 } 889 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698