OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/extension_view_host.h" | 5 #include "chrome/browser/extensions/extension_view_host.h" |
6 | 6 |
7 #include "base/strings/string_piece.h" | 7 #include "base/strings/string_piece.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/extensions/extension_view.h" | 9 #include "chrome/browser/extensions/extension_view.h" |
10 #include "chrome/browser/extensions/window_controller.h" | 10 #include "chrome/browser/extensions/window_controller.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // No style sheet for other types, at the moment. | 110 // No style sheet for other types, at the moment. |
111 InsertInfobarCSS(); | 111 InsertInfobarCSS(); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 void ExtensionViewHost::LoadInitialURL() { | 115 void ExtensionViewHost::LoadInitialURL() { |
116 if (!ExtensionSystem::Get(browser_context())-> | 116 if (!ExtensionSystem::Get(browser_context())-> |
117 runtime_data()->IsBackgroundPageReady(extension())) { | 117 runtime_data()->IsBackgroundPageReady(extension())) { |
118 // Make sure the background page loads before any others. | 118 // Make sure the background page loads before any others. |
119 registrar()->Add(this, | 119 registrar()->Add(this, |
120 chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, | 120 extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, |
121 content::Source<Extension>(extension())); | 121 content::Source<Extension>(extension())); |
122 return; | 122 return; |
123 } | 123 } |
124 | 124 |
125 // Popups may spawn modal dialogs, which need positioning information. | 125 // Popups may spawn modal dialogs, which need positioning information. |
126 if (extension_host_type() == VIEW_TYPE_EXTENSION_POPUP) { | 126 if (extension_host_type() == VIEW_TYPE_EXTENSION_POPUP) { |
127 WebContentsModalDialogManager::CreateForWebContents(host_contents()); | 127 WebContentsModalDialogManager::CreateForWebContents(host_contents()); |
128 WebContentsModalDialogManager::FromWebContents( | 128 WebContentsModalDialogManager::FromWebContents( |
129 host_contents())->SetDelegate(this); | 129 host_contents())->SetDelegate(this); |
130 if (!popup_manager_.get()) | 130 if (!popup_manager_.get()) |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 if (associated_web_contents_) | 298 if (associated_web_contents_) |
299 return associated_web_contents_; | 299 return associated_web_contents_; |
300 if (extension_host_type() == VIEW_TYPE_EXTENSION_POPUP) | 300 if (extension_host_type() == VIEW_TYPE_EXTENSION_POPUP) |
301 return host_contents(); | 301 return host_contents(); |
302 return NULL; | 302 return NULL; |
303 } | 303 } |
304 | 304 |
305 void ExtensionViewHost::Observe(int type, | 305 void ExtensionViewHost::Observe(int type, |
306 const content::NotificationSource& source, | 306 const content::NotificationSource& source, |
307 const content::NotificationDetails& details) { | 307 const content::NotificationDetails& details) { |
308 if (type == chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY) { | 308 if (type == extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY) { |
309 DCHECK(ExtensionSystem::Get(browser_context())-> | 309 DCHECK(ExtensionSystem::Get(browser_context())-> |
310 runtime_data()->IsBackgroundPageReady(extension())); | 310 runtime_data()->IsBackgroundPageReady(extension())); |
311 LoadInitialURL(); | 311 LoadInitialURL(); |
312 return; | 312 return; |
313 } | 313 } |
314 ExtensionHost::Observe(type, source, details); | 314 ExtensionHost::Observe(type, source, details); |
315 } | 315 } |
316 | 316 |
317 void ExtensionViewHost::InsertInfobarCSS() { | 317 void ExtensionViewHost::InsertInfobarCSS() { |
318 static const base::StringPiece css( | 318 static const base::StringPiece css( |
319 ResourceBundle::GetSharedInstance().GetRawDataResource( | 319 ResourceBundle::GetSharedInstance().GetRawDataResource( |
320 IDR_EXTENSIONS_INFOBAR_CSS)); | 320 IDR_EXTENSIONS_INFOBAR_CSS)); |
321 | 321 |
322 host_contents()->InsertCSS(css.as_string()); | 322 host_contents()->InsertCSS(css.as_string()); |
323 } | 323 } |
324 | 324 |
325 } // namespace extensions | 325 } // namespace extensions |
OLD | NEW |