OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_overflow_strip.h" | 5 #include "chrome/browser/ui/panels/panel_overflow_strip.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/ui/panels/panel_manager.h" | 8 #include "chrome/browser/ui/panels/panel_manager.h" |
9 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 9 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
10 #include "chrome/browser/ui/panels/panel_strip.h" | 10 #include "chrome/browser/ui/panels/panel_strip.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 ShowOverflowTitles(show_overflow_titles); | 150 ShowOverflowTitles(show_overflow_titles); |
151 } | 151 } |
152 | 152 |
153 bool PanelOverflowStrip::ShouldShowOverflowTitles( | 153 bool PanelOverflowStrip::ShouldShowOverflowTitles( |
154 const gfx::Point& mouse_position) const { | 154 const gfx::Point& mouse_position) const { |
155 if (panels_.empty()) | 155 if (panels_.empty()) |
156 return false; | 156 return false; |
157 | 157 |
158 int width = are_overflow_titles_shown_ ? kOverflowAreaHoverWidth | 158 int width = are_overflow_titles_shown_ ? kOverflowAreaHoverWidth |
159 : display_area_.width(); | 159 : display_area_.width(); |
160 return display_area_.x() <= mouse_position.x() && | 160 return mouse_position.x() <= display_area_.x() + width && |
161 mouse_position.x() <= display_area_.x() + width && | |
162 panels_.back()->GetBounds().y() <= mouse_position.y() && | 161 panels_.back()->GetBounds().y() <= mouse_position.y() && |
163 mouse_position.y() <= display_area_.bottom(); | 162 mouse_position.y() <= display_area_.bottom(); |
164 } | 163 } |
165 | 164 |
166 void PanelOverflowStrip::ShowOverflowTitles(bool show_overflow_titles) { | 165 void PanelOverflowStrip::ShowOverflowTitles(bool show_overflow_titles) { |
167 if (show_overflow_titles == are_overflow_titles_shown_) | 166 if (show_overflow_titles == are_overflow_titles_shown_) |
168 return; | 167 return; |
169 are_overflow_titles_shown_ = show_overflow_titles; | 168 are_overflow_titles_shown_ = show_overflow_titles; |
170 | 169 |
171 if (show_overflow_titles) { | 170 if (show_overflow_titles) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 210 } |
212 | 211 |
213 overflow_panel->SetPanelBoundsInstantly(bounds); | 212 overflow_panel->SetPanelBoundsInstantly(bounds); |
214 } | 213 } |
215 } | 214 } |
216 | 215 |
217 void PanelOverflowStrip::OnFullScreenModeChanged(bool is_full_screen) { | 216 void PanelOverflowStrip::OnFullScreenModeChanged(bool is_full_screen) { |
218 for (size_t i = 0; i < panels_.size(); ++i) | 217 for (size_t i = 0; i < panels_.size(); ++i) |
219 panels_[i]->FullScreenModeChanged(is_full_screen); | 218 panels_[i]->FullScreenModeChanged(is_full_screen); |
220 } | 219 } |
OLD | NEW |