| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 InitCommandState(); | 175 InitCommandState(); |
| 176 | 176 |
| 177 // Set up hosting for web contents. | 177 // Set up hosting for web contents. |
| 178 panel_host_.reset(new PanelHost(this, profile)); | 178 panel_host_.reset(new PanelHost(this, profile)); |
| 179 panel_host_->Init(url); | 179 panel_host_->Init(url); |
| 180 native_panel_->AttachWebContents(GetWebContents()); | 180 native_panel_->AttachWebContents(GetWebContents()); |
| 181 | 181 |
| 182 // Close when the extension is unloaded or the browser is exiting. | 182 // Close when the extension is unloaded or the browser is exiting. |
| 183 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 183 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 184 content::Source<Profile>(profile)); | 184 content::Source<Profile>(profile)); |
| 185 registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, | 185 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
| 186 content::NotificationService::AllSources()); | 186 content::NotificationService::AllSources()); |
| 187 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 187 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 188 content::Source<ThemeService>( | 188 content::Source<ThemeService>( |
| 189 ThemeServiceFactory::GetForProfile(profile))); | 189 ThemeServiceFactory::GetForProfile(profile))); |
| 190 | 190 |
| 191 // Prevent the browser process from shutting down while this window is open. | 191 // Prevent the browser process from shutting down while this window is open. |
| 192 browser::StartKeepAlive(); | 192 browser::StartKeepAlive(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void Panel::InitCommandState() { | 195 void Panel::InitCommandState() { |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 const content::NotificationDetails& details) { | 623 const content::NotificationDetails& details) { |
| 624 switch (type) { | 624 switch (type) { |
| 625 case content::NOTIFICATION_WEB_CONTENTS_SWAPPED: | 625 case content::NOTIFICATION_WEB_CONTENTS_SWAPPED: |
| 626 ConfigureAutoResize(content::Source<content::WebContents>(source).ptr()); | 626 ConfigureAutoResize(content::Source<content::WebContents>(source).ptr()); |
| 627 break; | 627 break; |
| 628 case chrome::NOTIFICATION_EXTENSION_UNLOADED: | 628 case chrome::NOTIFICATION_EXTENSION_UNLOADED: |
| 629 if (content::Details<extensions::UnloadedExtensionInfo>( | 629 if (content::Details<extensions::UnloadedExtensionInfo>( |
| 630 details)->extension->id() == extension_id()) | 630 details)->extension->id() == extension_id()) |
| 631 Close(); | 631 Close(); |
| 632 break; | 632 break; |
| 633 case content::NOTIFICATION_APP_TERMINATING: | 633 case chrome::NOTIFICATION_APP_TERMINATING: |
| 634 Close(); | 634 Close(); |
| 635 break; | 635 break; |
| 636 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: | 636 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: |
| 637 native_panel_->NotifyPanelOnUserChangedTheme(); | 637 native_panel_->NotifyPanelOnUserChangedTheme(); |
| 638 break; | 638 break; |
| 639 default: | 639 default: |
| 640 NOTREACHED() << "Received unexpected notification " << type; | 640 NOTREACHED() << "Received unexpected notification " << type; |
| 641 } | 641 } |
| 642 } | 642 } |
| 643 | 643 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 | 776 |
| 777 void Panel::LoadingStateChanged(bool is_loading) { | 777 void Panel::LoadingStateChanged(bool is_loading) { |
| 778 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading); | 778 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading); |
| 779 native_panel_->UpdatePanelLoadingAnimations(is_loading); | 779 native_panel_->UpdatePanelLoadingAnimations(is_loading); |
| 780 UpdateTitleBar(); | 780 UpdateTitleBar(); |
| 781 } | 781 } |
| 782 | 782 |
| 783 void Panel::WebContentsFocused(content::WebContents* contents) { | 783 void Panel::WebContentsFocused(content::WebContents* contents) { |
| 784 native_panel_->PanelWebContentsFocused(contents); | 784 native_panel_->PanelWebContentsFocused(contents); |
| 785 } | 785 } |
| OLD | NEW |