| 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/extensions/shell_window.h" | 5 #include "chrome/browser/ui/extensions/shell_window.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/extensions/extension_process_manager.h" | 8 #include "chrome/browser/extensions/extension_process_manager.h" |
| 9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
| 10 #include "chrome/browser/extensions/shell_window_geometry_cache.h" | 10 #include "chrome/browser/extensions/shell_window_geometry_cache.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 web_contents_->GetController().LoadURL( | 149 web_contents_->GetController().LoadURL( |
| 150 url, content::Referrer(), content::PAGE_TRANSITION_LINK, | 150 url, content::Referrer(), content::PAGE_TRANSITION_LINK, |
| 151 std::string()); | 151 std::string()); |
| 152 registrar_.RemoveAll(); | 152 registrar_.RemoveAll(); |
| 153 | 153 |
| 154 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 154 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 155 content::Source<Profile>(profile_)); | 155 content::Source<Profile>(profile_)); |
| 156 // Close when the browser is exiting. | 156 // Close when the browser is exiting. |
| 157 // TODO(mihaip): we probably don't want this in the long run (when platform | 157 // TODO(mihaip): we probably don't want this in the long run (when platform |
| 158 // apps are no longer tied to the browser process). | 158 // apps are no longer tied to the browser process). |
| 159 registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, | 159 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
| 160 content::NotificationService::AllSources()); | 160 content::NotificationService::AllSources()); |
| 161 | 161 |
| 162 // Automatically dismiss all infobars. | 162 // Automatically dismiss all infobars. |
| 163 TabContents* tab_contents = TabContents::FromWebContents(web_contents_); | 163 TabContents* tab_contents = TabContents::FromWebContents(web_contents_); |
| 164 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); | 164 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); |
| 165 infobar_helper->set_infobars_enabled(false); | 165 infobar_helper->set_infobars_enabled(false); |
| 166 | 166 |
| 167 // Prevent the browser process from shutting down while this window is open. | 167 // Prevent the browser process from shutting down while this window is open. |
| 168 browser::StartKeepAlive(); | 168 browser::StartKeepAlive(); |
| 169 | 169 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 break; | 411 break; |
| 412 } | 412 } |
| 413 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 413 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { |
| 414 const extensions::Extension* unloaded_extension = | 414 const extensions::Extension* unloaded_extension = |
| 415 content::Details<extensions::UnloadedExtensionInfo>( | 415 content::Details<extensions::UnloadedExtensionInfo>( |
| 416 details)->extension; | 416 details)->extension; |
| 417 if (extension_ == unloaded_extension) | 417 if (extension_ == unloaded_extension) |
| 418 native_window_->Close(); | 418 native_window_->Close(); |
| 419 break; | 419 break; |
| 420 } | 420 } |
| 421 case content::NOTIFICATION_APP_TERMINATING: | 421 case chrome::NOTIFICATION_APP_TERMINATING: |
| 422 native_window_->Close(); | 422 native_window_->Close(); |
| 423 break; | 423 break; |
| 424 default: | 424 default: |
| 425 NOTREACHED() << "Received unexpected notification"; | 425 NOTREACHED() << "Received unexpected notification"; |
| 426 } | 426 } |
| 427 } | 427 } |
| 428 | 428 |
| 429 extensions::WindowController* | 429 extensions::WindowController* |
| 430 ShellWindow::GetExtensionWindowController() const { | 430 ShellWindow::GetExtensionWindowController() const { |
| 431 return NULL; | 431 return NULL; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 454 if (window_key_.empty()) | 454 if (window_key_.empty()) |
| 455 return; | 455 return; |
| 456 | 456 |
| 457 extensions::ShellWindowGeometryCache* cache = | 457 extensions::ShellWindowGeometryCache* cache = |
| 458 extensions::ExtensionSystem::Get(profile())-> | 458 extensions::ExtensionSystem::Get(profile())-> |
| 459 shell_window_geometry_cache(); | 459 shell_window_geometry_cache(); |
| 460 | 460 |
| 461 gfx::Rect bounds = native_window_->GetBounds(); | 461 gfx::Rect bounds = native_window_->GetBounds(); |
| 462 cache->SaveGeometry(extension()->id(), window_key_, bounds); | 462 cache->SaveGeometry(extension()->id(), window_key_, bounds); |
| 463 } | 463 } |
| OLD | NEW |