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.h" | 5 #include "chrome/browser/ui/panels/panel.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 // panel collection because it needs to check internal state of the panel to | 343 // panel collection because it needs to check internal state of the panel to |
344 // determine if the panel has been drawing attention. | 344 // determine if the panel has been drawing attention. |
345 native_panel_->DrawAttention(draw_attention); | 345 native_panel_->DrawAttention(draw_attention); |
346 collection_->OnPanelAttentionStateChanged(this); | 346 collection_->OnPanelAttentionStateChanged(this); |
347 } | 347 } |
348 | 348 |
349 bool Panel::IsAlwaysOnTop() const { | 349 bool Panel::IsAlwaysOnTop() const { |
350 return native_panel_->IsPanelAlwaysOnTop(); | 350 return native_panel_->IsPanelAlwaysOnTop(); |
351 } | 351 } |
352 | 352 |
| 353 void Panel::SetAlwaysOnTop(bool on_top) { |
| 354 native_panel_->SetPanelAlwaysOnTop(on_top); |
| 355 } |
| 356 |
353 void Panel::ExecuteCommandWithDisposition(int id, | 357 void Panel::ExecuteCommandWithDisposition(int id, |
354 WindowOpenDisposition disposition) { | 358 WindowOpenDisposition disposition) { |
355 DCHECK(command_updater_.IsCommandEnabled(id)) << "Invalid/disabled command " | 359 DCHECK(command_updater_.IsCommandEnabled(id)) << "Invalid/disabled command " |
356 << id; | 360 << id; |
357 | 361 |
358 if (!GetWebContents()) | 362 if (!GetWebContents()) |
359 return; | 363 return; |
360 | 364 |
361 switch (id) { | 365 switch (id) { |
362 // Navigation | 366 // Navigation |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 if (new_max_size.height() < desired_panel_size.height()) | 655 if (new_max_size.height() < desired_panel_size.height()) |
652 new_max_size.set_height(desired_panel_size.height()); | 656 new_max_size.set_height(desired_panel_size.height()); |
653 | 657 |
654 SetSizeRange(min_size_, new_max_size); | 658 SetSizeRange(min_size_, new_max_size); |
655 } | 659 } |
656 | 660 |
657 void Panel::HandleKeyboardEvent(const content::NativeWebKeyboardEvent& event) { | 661 void Panel::HandleKeyboardEvent(const content::NativeWebKeyboardEvent& event) { |
658 native_panel_->HandlePanelKeyboardEvent(event); | 662 native_panel_->HandlePanelKeyboardEvent(event); |
659 } | 663 } |
660 | 664 |
661 void Panel::SetAlwaysOnTop(bool on_top) { | |
662 native_panel_->SetPanelAlwaysOnTop(on_top); | |
663 } | |
664 | |
665 void Panel::SetPreviewMode(bool in_preview) { | 665 void Panel::SetPreviewMode(bool in_preview) { |
666 DCHECK_NE(in_preview_mode_, in_preview); | 666 DCHECK_NE(in_preview_mode_, in_preview); |
667 in_preview_mode_ = in_preview; | 667 in_preview_mode_ = in_preview; |
668 } | 668 } |
669 | 669 |
670 void Panel::UpdateMinimizeRestoreButtonVisibility() { | 670 void Panel::UpdateMinimizeRestoreButtonVisibility() { |
671 native_panel_->UpdatePanelMinimizeRestoreButtonVisibility(); | 671 native_panel_->UpdatePanelMinimizeRestoreButtonVisibility(); |
672 } | 672 } |
673 | 673 |
674 gfx::Size Panel::ClampSize(const gfx::Size& size) const { | 674 gfx::Size Panel::ClampSize(const gfx::Size& size) const { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 | 889 |
890 // static | 890 // static |
891 void Panel::FormatTitleForDisplay(string16* title) { | 891 void Panel::FormatTitleForDisplay(string16* title) { |
892 size_t current_index = 0; | 892 size_t current_index = 0; |
893 size_t match_index; | 893 size_t match_index; |
894 while ((match_index = title->find(L'\n', current_index)) != string16::npos) { | 894 while ((match_index = title->find(L'\n', current_index)) != string16::npos) { |
895 title->replace(match_index, 1, string16()); | 895 title->replace(match_index, 1, string16()); |
896 current_index = match_index; | 896 current_index = match_index; |
897 } | 897 } |
898 } | 898 } |
OLD | NEW |