Chromium Code Reviews| 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 "chrome/browser/chrome_plugin_service_filter.h" | 7 #include "chrome/browser/chrome_plugin_service_filter.h" |
| 8 #include "chrome/browser/extensions/extension_process_manager.h" | 8 #include "chrome/browser/extensions/extension_process_manager.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 } | 59 } |
| 60 case content::NOTIFICATION_APP_TERMINATING: | 60 case content::NOTIFICATION_APP_TERMINATING: |
| 61 Close(); | 61 Close(); |
| 62 break; | 62 break; |
| 63 default: | 63 default: |
| 64 NOTREACHED() << "Received unexpected notification"; | 64 NOTREACHED() << "Received unexpected notification"; |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 void ShellWindow::RenderViewCreated(RenderViewHost* render_view_host) { | 68 void ShellWindow::RenderViewCreated(RenderViewHost* render_view_host) { |
| 69 // Notify anyone interested that the app has started. | |
|
Mihai Parparita -not on Chrome
2012/01/25 19:52:49
We might have non-ShellWindow UIs for platform app
benwells
2012/01/27 04:03:52
Done: just used NOTIFICATION_EXTENSION_HOST_CREATE
| |
| 70 content::NotificationService::current()->Notify( | |
| 71 chrome::NOTIFICATION_PLATFORM_APP_STARTED, | |
| 72 content::Source<Profile>(host_->profile()), | |
| 73 content::Details<const Extension>(host_->extension())); | |
| 69 DisableNPAPIPlugins(); | 74 DisableNPAPIPlugins(); |
| 70 } | 75 } |
| 71 | 76 |
| 72 ShellWindow::ShellWindow(ExtensionHost* host) | 77 ShellWindow::ShellWindow(ExtensionHost* host) |
| 73 : host_(host) { | 78 : host_(host) { |
| 74 // Close the window in response to window.close() and the like. | 79 // Close the window in response to window.close() and the like. |
| 75 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, | 80 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
| 76 content::Source<Profile>(host->profile())); | 81 content::Source<Profile>(host->profile())); |
| 77 // Also close if the window if the extension has been unloaded (parallels | 82 // Also close if the window if the extension has been unloaded (parallels |
| 78 // NOTIFICATION_EXTENSION_UNLOADED closing the app's tabs in TabStripModel). | 83 // NOTIFICATION_EXTENSION_UNLOADED closing the app's tabs in TabStripModel). |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 100 } | 105 } |
| 101 | 106 |
| 102 void ShellWindow::ClearDisabledNPAPIPlugins() { | 107 void ShellWindow::ClearDisabledNPAPIPlugins() { |
| 103 int render_process_id = host_->render_process_host()->GetID(); | 108 int render_process_id = host_->render_process_host()->GetID(); |
| 104 int render_view_id = host_->render_view_host()->routing_id(); | 109 int render_view_id = host_->render_view_host()->routing_id(); |
| 105 ChromePluginServiceFilter* filter = | 110 ChromePluginServiceFilter* filter = |
| 106 ChromePluginServiceFilter::GetInstance(); | 111 ChromePluginServiceFilter::GetInstance(); |
| 107 filter->ClearDisabledNPAPIForRenderView(render_process_id, | 112 filter->ClearDisabledNPAPIForRenderView(render_process_id, |
| 108 render_view_id); | 113 render_view_id); |
| 109 } | 114 } |
| OLD | NEW |