| 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_strip.h" | 5 #include "chrome/browser/ui/panels/panel_strip.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/panels/native_panel.h" |
| 13 #include "chrome/browser/ui/panels/panel_manager.h" | 14 #include "chrome/browser/ui/panels/panel_manager.h" |
| 14 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 15 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
| 15 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 16 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
| 17 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 // Invalid panel index. | 21 // Invalid panel index. |
| 21 const size_t kInvalidPanelIndex = static_cast<size_t>(-1); | 22 const size_t kInvalidPanelIndex = static_cast<size_t>(-1); |
| 22 | 23 |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 AutoHidingDesktopBar::Visibility expected_visibility = | 539 AutoHidingDesktopBar::Visibility expected_visibility = |
| 539 delayed_titlebar_action_ == BRING_UP ? AutoHidingDesktopBar::VISIBLE | 540 delayed_titlebar_action_ == BRING_UP ? AutoHidingDesktopBar::VISIBLE |
| 540 : AutoHidingDesktopBar::HIDDEN; | 541 : AutoHidingDesktopBar::HIDDEN; |
| 541 if (visibility != expected_visibility) | 542 if (visibility != expected_visibility) |
| 542 return; | 543 return; |
| 543 | 544 |
| 544 DoBringUpOrDownTitlebars(delayed_titlebar_action_ == BRING_UP); | 545 DoBringUpOrDownTitlebars(delayed_titlebar_action_ == BRING_UP); |
| 545 delayed_titlebar_action_ = NO_ACTION; | 546 delayed_titlebar_action_ = NO_ACTION; |
| 546 } | 547 } |
| 547 | 548 |
| 549 void PanelStrip::OnFullScreenModeChanged(bool is_full_screen_mode_on) { |
| 550 for (size_t i = 0; i < panels_.size(); ++i) |
| 551 panels_[i]->native_panel()->FullScreenModeChanged(is_full_screen_mode_on); |
| 552 } |
| 553 |
| 548 void PanelStrip::Rearrange(Panels::iterator iter_to_start, | 554 void PanelStrip::Rearrange(Panels::iterator iter_to_start, |
| 549 int rightmost_position) { | 555 int rightmost_position) { |
| 550 for (Panels::iterator iter = iter_to_start; iter != panels_.end(); ++iter) { | 556 for (Panels::iterator iter = iter_to_start; iter != panels_.end(); ++iter) { |
| 551 Panel* panel = *iter; | 557 Panel* panel = *iter; |
| 552 gfx::Rect new_bounds(panel->GetBounds()); | 558 gfx::Rect new_bounds(panel->GetBounds()); |
| 553 new_bounds.set_x(rightmost_position - new_bounds.width()); | 559 new_bounds.set_x(rightmost_position - new_bounds.width()); |
| 554 new_bounds.set_y( | 560 new_bounds.set_y( |
| 555 GetBottomPositionForExpansionState(panel->expansion_state()) - | 561 GetBottomPositionForExpansionState(panel->expansion_state()) - |
| 556 new_bounds.height()); | 562 new_bounds.height()); |
| 557 panel->SetPanelBounds(new_bounds); | 563 panel->SetPanelBounds(new_bounds); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 569 | 575 |
| 570 // Start from the bottom to avoid reshuffling. | 576 // Start from the bottom to avoid reshuffling. |
| 571 for (Panels::reverse_iterator iter = panels_copy.rbegin(); | 577 for (Panels::reverse_iterator iter = panels_copy.rbegin(); |
| 572 iter != panels_copy.rend(); ++iter) | 578 iter != panels_copy.rend(); ++iter) |
| 573 (*iter)->Close(); | 579 (*iter)->Close(); |
| 574 } | 580 } |
| 575 | 581 |
| 576 bool PanelStrip::is_dragging_panel() const { | 582 bool PanelStrip::is_dragging_panel() const { |
| 577 return dragging_panel_index_ != kInvalidPanelIndex; | 583 return dragging_panel_index_ != kInvalidPanelIndex; |
| 578 } | 584 } |
| OLD | NEW |