| 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.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 bounds.set_x(bounds.right() - full_size_.width()); | 251 bounds.set_x(bounds.right() - full_size_.width()); |
| 252 bounds.set_size(full_size_); | 252 bounds.set_size(full_size_); |
| 253 return bounds; | 253 return bounds; |
| 254 } | 254 } |
| 255 | 255 |
| 256 gfx::Rect Panel::GetBounds() const { | 256 gfx::Rect Panel::GetBounds() const { |
| 257 return native_panel_->GetPanelBounds(); | 257 return native_panel_->GetPanelBounds(); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void Panel::Show() { | 260 void Panel::Show() { |
| 261 if (manager()->display_settings_provider()->is_full_screen() || !collection_) | |
| 262 return; | |
| 263 | |
| 264 native_panel_->ShowPanel(); | 261 native_panel_->ShowPanel(); |
| 265 } | 262 } |
| 266 | 263 |
| 267 void Panel::Hide() { | 264 void Panel::Hide() { |
| 268 // Not implemented. | 265 // Not implemented. |
| 269 } | 266 } |
| 270 | 267 |
| 271 void Panel::ShowInactive() { | 268 void Panel::ShowInactive() { |
| 269 // Only if the panel is created without initial focus, we delay its showing |
| 270 // until the fullscreen mode is exited. |
| 272 if (manager()->display_settings_provider()->is_full_screen() || !collection_) | 271 if (manager()->display_settings_provider()->is_full_screen() || !collection_) |
| 273 return; | 272 return; |
| 274 | 273 |
| 275 native_panel_->ShowPanelInactive(); | 274 native_panel_->ShowPanelInactive(); |
| 276 } | 275 } |
| 277 | 276 |
| 278 // Close() may be called multiple times if the panel window is not ready to | 277 // Close() may be called multiple times if the panel window is not ready to |
| 279 // close on the first attempt. | 278 // close on the first attempt. |
| 280 void Panel::Close() { | 279 void Panel::Close() { |
| 281 native_panel_->ClosePanel(); | 280 native_panel_->ClosePanel(); |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 | 874 |
| 876 // static | 875 // static |
| 877 void Panel::FormatTitleForDisplay(string16* title) { | 876 void Panel::FormatTitleForDisplay(string16* title) { |
| 878 size_t current_index = 0; | 877 size_t current_index = 0; |
| 879 size_t match_index; | 878 size_t match_index; |
| 880 while ((match_index = title->find(L'\n', current_index)) != string16::npos) { | 879 while ((match_index = title->find(L'\n', current_index)) != string16::npos) { |
| 881 title->replace(match_index, 1, string16()); | 880 title->replace(match_index, 1, string16()); |
| 882 current_index = match_index; | 881 current_index = match_index; |
| 883 } | 882 } |
| 884 } | 883 } |
| OLD | NEW |