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/panel_browser_frame_view.h" | 5 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 // screen coordinate system. | 564 // screen coordinate system. |
565 gfx::Point mouse_location = event.location(); | 565 gfx::Point mouse_location = event.location(); |
566 views::View::ConvertPointToScreen(this, &mouse_location); | 566 views::View::ConvertPointToScreen(this, &mouse_location); |
567 | 567 |
568 if (panel_browser_view_->OnTitlebarMouseDragged(mouse_location)) | 568 if (panel_browser_view_->OnTitlebarMouseDragged(mouse_location)) |
569 return true; | 569 return true; |
570 return BrowserNonClientFrameView::OnMouseDragged(event); | 570 return BrowserNonClientFrameView::OnMouseDragged(event); |
571 } | 571 } |
572 | 572 |
573 void PanelBrowserFrameView::OnMouseReleased(const views::MouseEvent& event) { | 573 void PanelBrowserFrameView::OnMouseReleased(const views::MouseEvent& event) { |
574 if (panel_browser_view_->OnTitlebarMouseReleased()) | 574 if (panel_browser_view_->OnTitlebarMouseReleased( |
| 575 event.IsControlDown() ? panel::APPLY_TO_ALL : panel::NO_MODIFIER)) |
575 return; | 576 return; |
576 BrowserNonClientFrameView::OnMouseReleased(event); | 577 BrowserNonClientFrameView::OnMouseReleased(event); |
577 } | 578 } |
578 | 579 |
579 void PanelBrowserFrameView::OnMouseCaptureLost() { | 580 void PanelBrowserFrameView::OnMouseCaptureLost() { |
580 if (panel_browser_view_->OnTitlebarMouseCaptureLost()) | 581 if (panel_browser_view_->OnTitlebarMouseCaptureLost()) |
581 return; | 582 return; |
582 BrowserNonClientFrameView::OnMouseCaptureLost(); | 583 BrowserNonClientFrameView::OnMouseCaptureLost(); |
583 } | 584 } |
584 | 585 |
585 void PanelBrowserFrameView::ButtonPressed(views::Button* sender, | 586 void PanelBrowserFrameView::ButtonPressed(views::Button* sender, |
586 const views::Event& event) { | 587 const views::Event& event) { |
587 if (sender == close_button_) | 588 if (sender == close_button_) { |
588 frame()->Close(); | 589 frame()->Close(); |
589 else if (sender == minimize_button_) | 590 } else { |
590 panel_browser_view_->panel()->Minimize(); | 591 panel::ClickModifier modifier = |
591 else if (sender == restore_button_) | 592 event.IsControlDown() ? panel::APPLY_TO_ALL : panel::NO_MODIFIER; |
592 panel_browser_view_->panel()->Restore(); | 593 if (sender == minimize_button_) |
| 594 panel_browser_view_->panel()->OnMinimizeButtonClicked(modifier); |
| 595 else if (sender == restore_button_) |
| 596 panel_browser_view_->panel()->OnRestoreButtonClicked(modifier); |
| 597 } |
593 } | 598 } |
594 | 599 |
595 bool PanelBrowserFrameView::ShouldTabIconViewAnimate() const { | 600 bool PanelBrowserFrameView::ShouldTabIconViewAnimate() const { |
596 // This function is queried during the creation of the window as the | 601 // This function is queried during the creation of the window as the |
597 // TabIconView we host is initialized, so we need to NULL check the selected | 602 // TabIconView we host is initialized, so we need to NULL check the selected |
598 // WebContents because in this condition there is not yet a selected tab. | 603 // WebContents because in this condition there is not yet a selected tab. |
599 WebContents* current_tab = browser_view()->GetSelectedWebContents(); | 604 WebContents* current_tab = browser_view()->GetSelectedWebContents(); |
600 return current_tab ? current_tab->IsLoading() : false; | 605 return current_tab ? current_tab->IsLoading() : false; |
601 } | 606 } |
602 | 607 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 } | 816 } |
812 | 817 |
813 bool PanelBrowserFrameView::CanResize() const { | 818 bool PanelBrowserFrameView::CanResize() const { |
814 return panel_browser_view_->panel()->CanResizeByMouse() != | 819 return panel_browser_view_->panel()->CanResizeByMouse() != |
815 panel::NOT_RESIZABLE; | 820 panel::NOT_RESIZABLE; |
816 } | 821 } |
817 | 822 |
818 bool PanelBrowserFrameView::IsShowingTitlebarOnly() const { | 823 bool PanelBrowserFrameView::IsShowingTitlebarOnly() const { |
819 return height() <= kTitlebarHeight; | 824 return height() <= kTitlebarHeight; |
820 } | 825 } |
OLD | NEW |