| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_function_dispatcher.h" | 5 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
| 8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 NotificationService::current()->Notify( | 314 NotificationService::current()->Notify( |
| 315 NotificationType::EXTENSION_FUNCTION_DISPATCHER_DESTROYED, | 315 NotificationType::EXTENSION_FUNCTION_DISPATCHER_DESTROYED, |
| 316 Source<Profile>(profile_), | 316 Source<Profile>(profile_), |
| 317 Details<ExtensionFunctionDispatcher>(this)); | 317 Details<ExtensionFunctionDispatcher>(this)); |
| 318 } | 318 } |
| 319 | 319 |
| 320 Browser* ExtensionFunctionDispatcher::GetBrowser(bool include_incognito) { | 320 Browser* ExtensionFunctionDispatcher::GetBrowser(bool include_incognito) { |
| 321 return delegate_->GetBrowser(include_incognito); | 321 return delegate_->GetBrowser(include_incognito); |
| 322 } | 322 } |
| 323 | 323 |
| 324 ExtensionPopupHost* ExtensionFunctionDispatcher::GetPopupHost() { | |
| 325 ExtensionHost* extension_host = GetExtensionHost(); | |
| 326 if (extension_host) { | |
| 327 DCHECK(!GetExtensionDOMUI()) << | |
| 328 "Function dispatcher registered in too many environments."; | |
| 329 return extension_host->popup_host(); | |
| 330 } else { | |
| 331 ExtensionDOMUI* dom_ui = GetExtensionDOMUI(); | |
| 332 return dom_ui->popup_host(); | |
| 333 } | |
| 334 } | |
| 335 | |
| 336 ExtensionHost* ExtensionFunctionDispatcher::GetExtensionHost() { | 324 ExtensionHost* ExtensionFunctionDispatcher::GetExtensionHost() { |
| 337 return delegate_->GetExtensionHost(); | 325 return delegate_->GetExtensionHost(); |
| 338 } | 326 } |
| 339 | 327 |
| 340 ExtensionDOMUI* ExtensionFunctionDispatcher::GetExtensionDOMUI() { | 328 ExtensionDOMUI* ExtensionFunctionDispatcher::GetExtensionDOMUI() { |
| 341 return delegate_->GetExtensionDOMUI(); | 329 return delegate_->GetExtensionDOMUI(); |
| 342 } | 330 } |
| 343 | 331 |
| 344 Extension* ExtensionFunctionDispatcher::GetExtension() { | 332 Extension* ExtensionFunctionDispatcher::GetExtension() { |
| 345 ExtensionsService* service = profile()->GetExtensionsService(); | 333 ExtensionsService* service = profile()->GetExtensionsService(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 } | 384 } |
| 397 } | 385 } |
| 398 | 386 |
| 399 Profile* ExtensionFunctionDispatcher::profile() { | 387 Profile* ExtensionFunctionDispatcher::profile() { |
| 400 return profile_; | 388 return profile_; |
| 401 } | 389 } |
| 402 | 390 |
| 403 gfx::NativeWindow ExtensionFunctionDispatcher::GetFrameNativeWindow() { | 391 gfx::NativeWindow ExtensionFunctionDispatcher::GetFrameNativeWindow() { |
| 404 return delegate_ ? delegate_->GetFrameNativeWindow() : NULL; | 392 return delegate_ ? delegate_->GetFrameNativeWindow() : NULL; |
| 405 } | 393 } |
| OLD | NEW |