| OLD | NEW |
| 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 // the minimum size. | 487 // the minimum size. |
| 488 return gfx::Size(); | 488 return gfx::Size(); |
| 489 } | 489 } |
| 490 | 490 |
| 491 void PanelBrowserFrameView::Layout() { | 491 void PanelBrowserFrameView::Layout() { |
| 492 // Check if the width is only enough to show only the icon, or both icon | 492 // Check if the width is only enough to show only the icon, or both icon |
| 493 // and title. Hide corresponding controls accordingly. | 493 // and title. Hide corresponding controls accordingly. |
| 494 bool show_close_button = true; | 494 bool show_close_button = true; |
| 495 bool show_settings_button = true; | 495 bool show_settings_button = true; |
| 496 bool show_title_label = true; | 496 bool show_title_label = true; |
| 497 if (panel_browser_view_->panel()->expansion_state() == Panel::IN_OVERFLOW) { | 497 if (panel_browser_view_->panel()->layout_state() == Panel::IN_OVERFLOW) { |
| 498 if (width() <= IconOnlyWidth()) { | 498 if (width() <= IconOnlyWidth()) { |
| 499 show_close_button = false; | 499 show_close_button = false; |
| 500 show_settings_button = false; | 500 show_settings_button = false; |
| 501 show_title_label = false; | 501 show_title_label = false; |
| 502 } else { | 502 } else { |
| 503 show_settings_button = false; | 503 show_settings_button = false; |
| 504 } | 504 } |
| 505 } | 505 } |
| 506 | 506 |
| 507 if (!has_settings_button_) | 507 if (!has_settings_button_) |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 | 858 |
| 859 UpdateSettingsButtonVisibility(panel_browser_view_->focused(), | 859 UpdateSettingsButtonVisibility(panel_browser_view_->focused(), |
| 860 mouse_entered); | 860 mouse_entered); |
| 861 } | 861 } |
| 862 | 862 |
| 863 void PanelBrowserFrameView::UpdateSettingsButtonVisibility( | 863 void PanelBrowserFrameView::UpdateSettingsButtonVisibility( |
| 864 bool focused, bool cursor_in_view) { | 864 bool focused, bool cursor_in_view) { |
| 865 DCHECK(has_settings_button_); | 865 DCHECK(has_settings_button_); |
| 866 | 866 |
| 867 // The settings button is not shown in the overflow state. | 867 // The settings button is not shown in the overflow state. |
| 868 if (panel_browser_view_->panel()->expansion_state() == Panel::IN_OVERFLOW) | 868 if (panel_browser_view_->panel()->layout_state() == Panel::IN_OVERFLOW) |
| 869 return; | 869 return; |
| 870 | 870 |
| 871 bool is_settings_button_visible = focused || cursor_in_view; | 871 bool is_settings_button_visible = focused || cursor_in_view; |
| 872 if (is_settings_button_visible_ == is_settings_button_visible) | 872 if (is_settings_button_visible_ == is_settings_button_visible) |
| 873 return; | 873 return; |
| 874 is_settings_button_visible_ = is_settings_button_visible; | 874 is_settings_button_visible_ = is_settings_button_visible; |
| 875 | 875 |
| 876 // Even if we're hiding the settings button, we still make it visible for the | 876 // Even if we're hiding the settings button, we still make it visible for the |
| 877 // time period that the animation is running. | 877 // time period that the animation is running. |
| 878 settings_button_->SetVisible(true); | 878 settings_button_->SetVisible(true); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 899 | 899 |
| 900 settings_menu_model_.reset( | 900 settings_menu_model_.reset( |
| 901 new PanelSettingsMenuModel(panel_browser_view_->panel())); | 901 new PanelSettingsMenuModel(panel_browser_view_->panel())); |
| 902 settings_menu_adapter_.reset( | 902 settings_menu_adapter_.reset( |
| 903 new views::MenuModelAdapter(settings_menu_model_.get())); | 903 new views::MenuModelAdapter(settings_menu_model_.get())); |
| 904 settings_menu_ = new views::MenuItemView(settings_menu_adapter_.get()); | 904 settings_menu_ = new views::MenuItemView(settings_menu_adapter_.get()); |
| 905 settings_menu_adapter_->BuildMenu(settings_menu_); | 905 settings_menu_adapter_->BuildMenu(settings_menu_); |
| 906 settings_menu_runner_.reset(new views::MenuRunner(settings_menu_)); | 906 settings_menu_runner_.reset(new views::MenuRunner(settings_menu_)); |
| 907 return true; | 907 return true; |
| 908 } | 908 } |
| OLD | NEW |