| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 native_panel_(NULL), | 150 native_panel_(NULL), |
| 151 attention_mode_(USE_PANEL_ATTENTION), | 151 attention_mode_(USE_PANEL_ATTENTION), |
| 152 expansion_state_(EXPANDED), | 152 expansion_state_(EXPANDED), |
| 153 command_updater_(this), | 153 command_updater_(this), |
| 154 ALLOW_THIS_IN_INITIALIZER_LIST(image_loader_ptr_factory_(this)) { | 154 ALLOW_THIS_IN_INITIALIZER_LIST(image_loader_ptr_factory_(this)) { |
| 155 } | 155 } |
| 156 | 156 |
| 157 Panel::~Panel() { | 157 Panel::~Panel() { |
| 158 DCHECK(!collection_); | 158 DCHECK(!collection_); |
| 159 // Invoked by native panel destructor. Do not access native_panel_ here. | 159 // Invoked by native panel destructor. Do not access native_panel_ here. |
| 160 browser::EndKeepAlive(); // Remove shutdown prevention. | 160 chrome::EndKeepAlive(); // Remove shutdown prevention. |
| 161 } | 161 } |
| 162 | 162 |
| 163 void Panel::Initialize(Profile* profile, const GURL& url, | 163 void Panel::Initialize(Profile* profile, const GURL& url, |
| 164 const gfx::Rect& bounds) { | 164 const gfx::Rect& bounds) { |
| 165 DCHECK(!initialized_); | 165 DCHECK(!initialized_); |
| 166 DCHECK(!collection_); // Cannot be added to a collection until fully created. | 166 DCHECK(!collection_); // Cannot be added to a collection until fully created. |
| 167 DCHECK_EQ(EXPANDED, expansion_state_); | 167 DCHECK_EQ(EXPANDED, expansion_state_); |
| 168 DCHECK(!bounds.IsEmpty()); | 168 DCHECK(!bounds.IsEmpty()); |
| 169 initialized_ = true; | 169 initialized_ = true; |
| 170 profile_ = profile; | 170 profile_ = profile; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 184 // Close when the extension is unloaded or the browser is exiting. | 184 // Close when the extension is unloaded or the browser is exiting. |
| 185 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 185 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 186 content::Source<Profile>(profile)); | 186 content::Source<Profile>(profile)); |
| 187 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, | 187 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
| 188 content::NotificationService::AllSources()); | 188 content::NotificationService::AllSources()); |
| 189 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 189 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 190 content::Source<ThemeService>( | 190 content::Source<ThemeService>( |
| 191 ThemeServiceFactory::GetForProfile(profile))); | 191 ThemeServiceFactory::GetForProfile(profile))); |
| 192 | 192 |
| 193 // Prevent the browser process from shutting down while this window is open. | 193 // Prevent the browser process from shutting down while this window is open. |
| 194 browser::StartKeepAlive(); | 194 chrome::StartKeepAlive(); |
| 195 | 195 |
| 196 UpdateAppIcon(); | 196 UpdateAppIcon(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void Panel::InitCommandState() { | 199 void Panel::InitCommandState() { |
| 200 // All supported commands whose state isn't set automagically some other way | 200 // All supported commands whose state isn't set automagically some other way |
| 201 // (like Stop during a page load) must have their state initialized here, | 201 // (like Stop during a page load) must have their state initialized here, |
| 202 // otherwise they will be forever disabled. | 202 // otherwise they will be forever disabled. |
| 203 | 203 |
| 204 // Navigation commands | 204 // Navigation commands |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 if (!image.IsEmpty()) { | 851 if (!image.IsEmpty()) { |
| 852 app_icon_ = image; | 852 app_icon_ = image; |
| 853 native_panel_->UpdatePanelTitleBar(); | 853 native_panel_->UpdatePanelTitleBar(); |
| 854 } | 854 } |
| 855 | 855 |
| 856 content::NotificationService::current()->Notify( | 856 content::NotificationService::current()->Notify( |
| 857 chrome::NOTIFICATION_PANEL_APP_ICON_LOADED, | 857 chrome::NOTIFICATION_PANEL_APP_ICON_LOADED, |
| 858 content::Source<Panel>(this), | 858 content::Source<Panel>(this), |
| 859 content::NotificationService::NoDetails()); | 859 content::NotificationService::NoDetails()); |
| 860 } | 860 } |
| OLD | NEW |