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_browser_view.h" | 5 #include "chrome/browser/ui/panels/panel_browser_view.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/ui/panels/panel.h" | 9 #include "chrome/browser/ui/panels/panel.h" |
10 #include "chrome/browser/ui/panels/panel_bounds_animation.h" | 10 #include "chrome/browser/ui/panels/panel_bounds_animation.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 Paste(); | 321 Paste(); |
322 } | 322 } |
323 | 323 |
324 void PanelBrowserView::DrawAttention() { | 324 void PanelBrowserView::DrawAttention() { |
325 // Don't draw attention for active panel. | 325 // Don't draw attention for active panel. |
326 if (is_drawing_attention_ || focused_) | 326 if (is_drawing_attention_ || focused_) |
327 return; | 327 return; |
328 is_drawing_attention_ = true; | 328 is_drawing_attention_ = true; |
329 | 329 |
330 // Bring up the titlebar to get people's attention. | 330 // Bring up the titlebar to get people's attention. |
331 if (panel_->expansion_state() == Panel::MINIMIZED) | 331 if (panel_->layout_state() == Panel::DOCKED && |
| 332 panel_->expansion_state() == Panel::MINIMIZED) |
332 panel_->SetExpansionState(Panel::TITLE_ONLY); | 333 panel_->SetExpansionState(Panel::TITLE_ONLY); |
333 | 334 |
334 GetFrameView()->SchedulePaint(); | 335 GetFrameView()->SchedulePaint(); |
335 } | 336 } |
336 | 337 |
337 bool PanelBrowserView::IsDrawingAttention() const { | 338 bool PanelBrowserView::IsDrawingAttention() const { |
338 return is_drawing_attention_; | 339 return is_drawing_attention_; |
339 } | 340 } |
340 | 341 |
341 void PanelBrowserView::StopDrawingAttention() { | 342 void PanelBrowserView::StopDrawingAttention() { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 } | 479 } |
479 | 480 |
480 // If the panel drag was cancelled before the mouse is released, do not treat | 481 // If the panel drag was cancelled before the mouse is released, do not treat |
481 // this as a click. | 482 // this as a click. |
482 if (mouse_dragging_state_ != NO_DRAGGING) | 483 if (mouse_dragging_state_ != NO_DRAGGING) |
483 return true; | 484 return true; |
484 | 485 |
485 // Do not minimize the panel when we just clear the attention state. This is | 486 // Do not minimize the panel when we just clear the attention state. This is |
486 // a hack to prevent the panel from being minimized when the user clicks on | 487 // a hack to prevent the panel from being minimized when the user clicks on |
487 // the title-bar to clear the attention. | 488 // the title-bar to clear the attention. |
488 if (panel_->expansion_state() == Panel::EXPANDED && | 489 if (panel_->layout_state() == Panel::DOCKED && |
| 490 panel_->expansion_state() == Panel::EXPANDED && |
489 base::TimeTicks::Now() - attention_cleared_time_ < | 491 base::TimeTicks::Now() - attention_cleared_time_ < |
490 base::TimeDelta::FromMilliseconds(kSuspendMinimizeOnClickIntervalMs)) { | 492 base::TimeDelta::FromMilliseconds(kSuspendMinimizeOnClickIntervalMs)) { |
491 return true; | 493 return true; |
492 } | 494 } |
493 | 495 |
494 // Ignore long clicks. Treated as a canceled click to be consistent with Mac. | 496 // Ignore long clicks. Treated as a canceled click to be consistent with Mac. |
495 if (base::TimeTicks::Now() - mouse_pressed_time_ > | 497 if (base::TimeTicks::Now() - mouse_pressed_time_ > |
496 base::TimeDelta::FromMilliseconds(kShortClickThresholdMs)) | 498 base::TimeDelta::FromMilliseconds(kShortClickThresholdMs)) |
497 return true; | 499 return true; |
498 | 500 |
499 Panel::ExpansionState new_expansion_state = | 501 if (panel_->layout_state() == Panel::IN_OVERFLOW) { |
500 (panel_->expansion_state() != Panel::EXPANDED) ? Panel::EXPANDED | 502 panel_->SetLayoutState(Panel::DOCKED); |
501 : Panel::MINIMIZED; | 503 panel_->SetExpansionState(Panel::EXPANDED); |
502 panel_->SetExpansionState(new_expansion_state); | 504 } else { |
| 505 Panel::ExpansionState new_expansion_state = |
| 506 (panel_->expansion_state() != Panel::EXPANDED) ? Panel::EXPANDED |
| 507 : Panel::MINIMIZED; |
| 508 panel_->SetExpansionState(new_expansion_state); |
| 509 } |
| 510 |
503 return true; | 511 return true; |
504 } | 512 } |
505 | 513 |
506 bool PanelBrowserView::OnTitlebarMouseCaptureLost() { | 514 bool PanelBrowserView::OnTitlebarMouseCaptureLost() { |
507 if (mouse_dragging_state_ == DRAGGING_STARTED) | 515 if (mouse_dragging_state_ == DRAGGING_STARTED) |
508 return EndDragging(true); | 516 return EndDragging(true); |
509 return true; | 517 return true; |
510 } | 518 } |
511 | 519 |
512 bool PanelBrowserView::EndDragging(bool cancelled) { | 520 bool PanelBrowserView::EndDragging(bool cancelled) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 } | 626 } |
619 | 627 |
620 bool NativePanelTestingWin::IsWindowSizeKnown() const { | 628 bool NativePanelTestingWin::IsWindowSizeKnown() const { |
621 return true; | 629 return true; |
622 } | 630 } |
623 | 631 |
624 bool NativePanelTestingWin::IsAnimatingBounds() const { | 632 bool NativePanelTestingWin::IsAnimatingBounds() const { |
625 return panel_browser_view_->bounds_animator_.get() && | 633 return panel_browser_view_->bounds_animator_.get() && |
626 panel_browser_view_->bounds_animator_->is_animating(); | 634 panel_browser_view_->bounds_animator_->is_animating(); |
627 } | 635 } |
OLD | NEW |