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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 bool PanelExtensionWindowController::IsVisibleToExtension( | 148 bool PanelExtensionWindowController::IsVisibleToExtension( |
149 const extensions::Extension* extension) const { | 149 const extensions::Extension* extension) const { |
150 return extension->id() == panel_->extension_id(); | 150 return extension->id() == panel_->extension_id(); |
151 } | 151 } |
152 | 152 |
153 } // namespace panel_internal | 153 } // namespace panel_internal |
154 | 154 |
155 Panel::~Panel() { | 155 Panel::~Panel() { |
156 DCHECK(!collection_); | 156 DCHECK(!collection_); |
157 // Invoked by native panel destructor. Do not access native_panel_ here. | 157 // Invoked by native panel destructor. Do not access native_panel_ here. |
158 chrome::EndKeepAlive(); // Remove shutdown prevention. | 158 chrome::DecrementKeepAliveCount(); // Remove shutdown prevention. |
159 } | 159 } |
160 | 160 |
161 PanelManager* Panel::manager() const { | 161 PanelManager* Panel::manager() const { |
162 return PanelManager::GetInstance(); | 162 return PanelManager::GetInstance(); |
163 } | 163 } |
164 | 164 |
165 const std::string Panel::extension_id() const { | 165 const std::string Panel::extension_id() const { |
166 return web_app::GetExtensionIdFromApplicationName(app_name_); | 166 return web_app::GetExtensionIdFromApplicationName(app_name_); |
167 } | 167 } |
168 | 168 |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 // Close when the extension is unloaded or the browser is exiting. | 531 // Close when the extension is unloaded or the browser is exiting. |
532 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 532 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
533 content::Source<Profile>(profile_)); | 533 content::Source<Profile>(profile_)); |
534 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, | 534 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
535 content::NotificationService::AllSources()); | 535 content::NotificationService::AllSources()); |
536 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 536 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
537 content::Source<ThemeService>( | 537 content::Source<ThemeService>( |
538 ThemeServiceFactory::GetForProfile(profile_))); | 538 ThemeServiceFactory::GetForProfile(profile_))); |
539 | 539 |
540 // Prevent the browser process from shutting down while this window is open. | 540 // Prevent the browser process from shutting down while this window is open. |
541 chrome::StartKeepAlive(); | 541 chrome::IncrementKeepAliveCount(); |
542 | 542 |
543 UpdateAppIcon(); | 543 UpdateAppIcon(); |
544 } | 544 } |
545 | 545 |
546 void Panel::SetPanelBounds(const gfx::Rect& bounds) { | 546 void Panel::SetPanelBounds(const gfx::Rect& bounds) { |
547 if (bounds != native_panel_->GetPanelBounds()) | 547 if (bounds != native_panel_->GetPanelBounds()) |
548 native_panel_->SetPanelBounds(bounds); | 548 native_panel_->SetPanelBounds(bounds); |
549 } | 549 } |
550 | 550 |
551 void Panel::SetPanelBoundsInstantly(const gfx::Rect& bounds) { | 551 void Panel::SetPanelBoundsInstantly(const gfx::Rect& bounds) { |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 // static | 888 // static |
889 void Panel::FormatTitleForDisplay(base::string16* title) { | 889 void Panel::FormatTitleForDisplay(base::string16* title) { |
890 size_t current_index = 0; | 890 size_t current_index = 0; |
891 size_t match_index; | 891 size_t match_index; |
892 while ((match_index = title->find(L'\n', current_index)) != | 892 while ((match_index = title->find(L'\n', current_index)) != |
893 base::string16::npos) { | 893 base::string16::npos) { |
894 title->replace(match_index, 1, base::string16()); | 894 title->replace(match_index, 1, base::string16()); |
895 current_index = match_index; | 895 current_index = match_index; |
896 } | 896 } |
897 } | 897 } |
OLD | NEW |