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/stacked_panel_collection.h" | 5 #include "chrome/browser/ui/panels/stacked_panel_collection.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 287 |
288 // If an active panel is being closed, try to focus the next recently active | 288 // If an active panel is being closed, try to focus the next recently active |
289 // panel in the stack that is not minimized. | 289 // panel in the stack that is not minimized. |
290 if (reason == PanelCollection::PANEL_CLOSED && | 290 if (reason == PanelCollection::PANEL_CLOSED && |
291 panel->IsActive() && | 291 panel->IsActive() && |
292 !most_recently_active_panels_.empty()) { | 292 !most_recently_active_panels_.empty()) { |
293 for (Panels::const_iterator iter = most_recently_active_panels_.begin(); | 293 for (Panels::const_iterator iter = most_recently_active_panels_.begin(); |
294 iter != most_recently_active_panels_.end(); ++iter) { | 294 iter != most_recently_active_panels_.end(); ++iter) { |
295 Panel* other_panel = *iter; | 295 Panel* other_panel = *iter; |
296 if (!IsPanelMinimized(other_panel)) { | 296 if (!IsPanelMinimized(other_panel)) { |
297 other_panel->Activate(); | 297 // TODO(johnme): Are there cases where this isn't a user gesture? |
| 298 other_panel->Activate(true /* user_gesture */); |
298 break; | 299 break; |
299 } | 300 } |
300 } | 301 } |
301 } | 302 } |
302 | 303 |
303 // If the top panel is closed, move up all other panels to stay at the same | 304 // If the top panel is closed, move up all other panels to stay at the same |
304 // y position as the top panel being closed. | 305 // y position as the top panel being closed. |
305 if (top_panel_closed) | 306 if (top_panel_closed) |
306 RefreshLayoutWithTopPanelStartingAt(top_origin, top_width); | 307 RefreshLayoutWithTopPanelStartingAt(top_origin, top_width); |
307 else if (reason == PanelCollection::PANEL_CLOSED) | 308 else if (reason == PanelCollection::PANEL_CLOSED) |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 if (available_space < 0) | 790 if (available_space < 0) |
790 available_space = 0; | 791 available_space = 0; |
791 return available_space; | 792 return available_space; |
792 } | 793 } |
793 | 794 |
794 NativePanelStackWindow* StackedPanelCollection::GetStackWindowForPanel( | 795 NativePanelStackWindow* StackedPanelCollection::GetStackWindowForPanel( |
795 Panel* panel) const { | 796 Panel* panel) const { |
796 return secondary_stack_window_ && secondary_stack_window_->HasPanel(panel) ? | 797 return secondary_stack_window_ && secondary_stack_window_->HasPanel(panel) ? |
797 secondary_stack_window_ : primary_stack_window_; | 798 secondary_stack_window_ : primary_stack_window_; |
798 } | 799 } |
OLD | NEW |