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

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

Issue 10051020: Move full-screen detection logic from PanelManager to DisplaySettingsProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux asan Created 8 years, 8 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
« no previous file with comments | « chrome/browser/ui/panels/docked_panel_strip.cc ('k') | chrome/browser/ui/panels/panel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/overflow_panel_strip.h" 5 #include "chrome/browser/ui/panels/overflow_panel_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_overflow_indicator.h" 10 #include "chrome/browser/ui/panels/panel_overflow_indicator.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 if (panel->has_temporary_layout()) { 92 if (panel->has_temporary_layout()) {
93 panel->set_has_temporary_layout(false); 93 panel->set_has_temporary_layout(false);
94 panels_.push_back(panel); 94 panels_.push_back(panel);
95 DoRefresh(panels_.size() - 1, panels_.size() - 1); 95 DoRefresh(panels_.size() - 1, panels_.size() - 1);
96 } else { 96 } else {
97 panels_.insert(panels_.begin(), panel); 97 panels_.insert(panels_.begin(), panel);
98 RefreshLayout(); 98 RefreshLayout();
99 } 99 }
100 100
101 if (num_panels() == 1) { 101 if (num_panels() == 1) {
102 if (!panel_manager_->is_full_screen()) 102 if (!panel_manager_->display_settings_provider()->is_full_screen())
103 panel_manager_->mouse_watcher()->AddObserver(this); 103 panel_manager_->mouse_watcher()->AddObserver(this);
104 UpdateMaxVisiblePanelsOnHover(); 104 UpdateMaxVisiblePanelsOnHover();
105 } 105 }
106 106
107 // Update the overflow indicator only when the number of overflow panels go 107 // Update the overflow indicator only when the number of overflow panels go
108 // beyond the maximum visible limit. 108 // beyond the maximum visible limit.
109 if (num_panels() > max_visible_panels_) { 109 if (num_panels() > max_visible_panels_) {
110 if (!overflow_indicator_.get()) { 110 if (!overflow_indicator_.get()) {
111 overflow_indicator_.reset(PanelOverflowIndicator::Create()); 111 overflow_indicator_.reset(PanelOverflowIndicator::Create());
112 } 112 }
113 UpdateOverflowIndicatorCount(); 113 UpdateOverflowIndicatorCount();
114 } 114 }
115 } 115 }
116 116
117 void OverflowPanelStrip::RemovePanel(Panel* panel) { 117 void OverflowPanelStrip::RemovePanel(Panel* panel) {
118 DCHECK_EQ(this, panel->panel_strip()); 118 DCHECK_EQ(this, panel->panel_strip());
119 panel->SetPanelStrip(NULL); 119 panel->SetPanelStrip(NULL);
120 120
121 size_t index = 0; 121 size_t index = 0;
122 Panels::iterator iter = panels_.begin(); 122 Panels::iterator iter = panels_.begin();
123 for (; iter != panels_.end(); ++iter, ++index) 123 for (; iter != panels_.end(); ++iter, ++index)
124 if (*iter == panel) 124 if (*iter == panel)
125 break; 125 break;
126 DCHECK(iter != panels_.end()); 126 DCHECK(iter != panels_.end());
127 127
128 panels_.erase(iter); 128 panels_.erase(iter);
129 DoRefresh(index, panels_.size() - 1); 129 DoRefresh(index, panels_.size() - 1);
130 130
131 if (panels_.empty() && !panel_manager_->is_full_screen()) 131 if (panels_.empty() &&
132 !panel_manager_->display_settings_provider()->is_full_screen())
132 panel_manager_->mouse_watcher()->RemoveObserver(this); 133 panel_manager_->mouse_watcher()->RemoveObserver(this);
133 134
134 // Update the overflow indicator. If the number of overflow panels fall below 135 // Update the overflow indicator. If the number of overflow panels fall below
135 // the maximum visible limit, we do not need the overflow indicator any more. 136 // the maximum visible limit, we do not need the overflow indicator any more.
136 if (num_panels() < max_visible_panels_) 137 if (num_panels() < max_visible_panels_)
137 overflow_indicator_.reset(); 138 overflow_indicator_.reset();
138 else 139 else
139 UpdateOverflowIndicatorCount(); 140 UpdateOverflowIndicatorCount();
140 } 141 }
141 142
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 return bounds; 337 return bounds;
337 } 338 }
338 339
339 void OverflowPanelStrip::OnMouseMove(const gfx::Point& mouse_position) { 340 void OverflowPanelStrip::OnMouseMove(const gfx::Point& mouse_position) {
340 bool show_overflow_titles = ShouldShowOverflowTitles(mouse_position); 341 bool show_overflow_titles = ShouldShowOverflowTitles(mouse_position);
341 ShowOverflowTitles(show_overflow_titles); 342 ShowOverflowTitles(show_overflow_titles);
342 } 343 }
343 344
344 bool OverflowPanelStrip::ShouldShowOverflowTitles( 345 bool OverflowPanelStrip::ShouldShowOverflowTitles(
345 const gfx::Point& mouse_position) const { 346 const gfx::Point& mouse_position) const {
346 if (panels_.empty() || panel_manager_->is_full_screen()) 347 if (panels_.empty() ||
348 panel_manager_->display_settings_provider()->is_full_screen())
347 return false; 349 return false;
348 350
349 Panel* top_visible_panel = num_panels() >= max_visible_panels() ? 351 Panel* top_visible_panel = num_panels() >= max_visible_panels() ?
350 panels_[max_visible_panels() - 1] : panels_.back(); 352 panels_[max_visible_panels() - 1] : panels_.back();
351 return mouse_position.x() <= display_area_.x() + current_display_width_ && 353 return mouse_position.x() <= display_area_.x() + current_display_width_ &&
352 top_visible_panel->GetBounds().y() <= mouse_position.y() && 354 top_visible_panel->GetBounds().y() <= mouse_position.y() &&
353 mouse_position.y() <= display_area_.bottom(); 355 mouse_position.y() <= display_area_.bottom();
354 } 356 }
355 357
356 void OverflowPanelStrip::ShowOverflowTitles(bool show_overflow_titles) { 358 void OverflowPanelStrip::ShowOverflowTitles(bool show_overflow_titles) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 panels_[i]->FullScreenModeChanged(is_full_screen); 454 panels_[i]->FullScreenModeChanged(is_full_screen);
453 } 455 }
454 456
455 void OverflowPanelStrip::UpdatePanelOnStripChange(Panel* panel) { 457 void OverflowPanelStrip::UpdatePanelOnStripChange(Panel* panel) {
456 // Set panel properties for this strip. 458 // Set panel properties for this strip.
457 panel->set_attention_mode(Panel::USE_PANEL_ATTENTION); 459 panel->set_attention_mode(Panel::USE_PANEL_ATTENTION);
458 panel->SetAppIconVisibility(false); 460 panel->SetAppIconVisibility(false);
459 panel->SetAlwaysOnTop(true); 461 panel->SetAlwaysOnTop(true);
460 panel->EnableResizeByMouse(false); 462 panel->EnableResizeByMouse(false);
461 } 463 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/docked_panel_strip.cc ('k') | chrome/browser/ui/panels/panel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698