| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_host.h" | 5 #include "chrome/browser/extensions/extension_host.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/renderer_host/render_view_host.h" | 25 #include "chrome/browser/renderer_host/render_view_host.h" |
| 26 #include "chrome/browser/renderer_host/render_process_host.h" | 26 #include "chrome/browser/renderer_host/render_process_host.h" |
| 27 #include "chrome/browser/renderer_host/render_widget_host.h" | 27 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 28 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 28 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 29 #include "chrome/browser/renderer_host/site_instance.h" | 29 #include "chrome/browser/renderer_host/site_instance.h" |
| 30 #include "chrome/browser/tab_contents/tab_contents.h" | 30 #include "chrome/browser/tab_contents/tab_contents.h" |
| 31 #include "chrome/browser/tab_contents/tab_contents_view.h" | 31 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 32 #include "chrome/common/bindings_policy.h" | 32 #include "chrome/common/bindings_policy.h" |
| 33 #include "chrome/common/extensions/extension.h" | 33 #include "chrome/common/extensions/extension.h" |
| 34 #include "chrome/common/notification_service.h" | 34 #include "chrome/common/notification_service.h" |
| 35 #include "chrome/common/platform_util.h" |
| 35 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 36 #include "chrome/common/pref_service.h" | 37 #include "chrome/common/pref_service.h" |
| 37 #include "chrome/common/view_types.h" | 38 #include "chrome/common/view_types.h" |
| 38 #include "chrome/common/render_messages.h" | 39 #include "chrome/common/render_messages.h" |
| 39 #include "chrome/common/url_constants.h" | 40 #include "chrome/common/url_constants.h" |
| 40 #include "grit/browser_resources.h" | 41 #include "grit/browser_resources.h" |
| 41 #include "grit/generated_resources.h" | 42 #include "grit/generated_resources.h" |
| 42 #include "webkit/glue/context_menu.h" | 43 #include "webkit/glue/context_menu.h" |
| 43 | 44 |
| 44 #if defined(TOOLKIT_VIEWS) | 45 #if defined(TOOLKIT_VIEWS) |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 408 |
| 408 void ExtensionHost::Close(RenderViewHost* render_view_host) { | 409 void ExtensionHost::Close(RenderViewHost* render_view_host) { |
| 409 if (extension_host_type_ == ViewType::EXTENSION_POPUP) { | 410 if (extension_host_type_ == ViewType::EXTENSION_POPUP) { |
| 410 NotificationService::current()->Notify( | 411 NotificationService::current()->Notify( |
| 411 NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, | 412 NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
| 412 Source<Profile>(profile_), | 413 Source<Profile>(profile_), |
| 413 Details<ExtensionHost>(this)); | 414 Details<ExtensionHost>(this)); |
| 414 } | 415 } |
| 415 } | 416 } |
| 416 | 417 |
| 418 RendererPreferences ExtensionHost::GetRendererPrefs() const { |
| 419 return platform_util::GetInitedRendererPreferences(); |
| 420 } |
| 421 |
| 417 WebPreferences ExtensionHost::GetWebkitPrefs() { | 422 WebPreferences ExtensionHost::GetWebkitPrefs() { |
| 418 PrefService* prefs = render_view_host()->process()->profile()->GetPrefs(); | 423 PrefService* prefs = render_view_host()->process()->profile()->GetPrefs(); |
| 419 const bool kIsDomUI = true; | 424 const bool kIsDomUI = true; |
| 420 WebPreferences webkit_prefs = | 425 WebPreferences webkit_prefs = |
| 421 RenderViewHostDelegateHelper::GetWebkitPrefs(prefs, kIsDomUI); | 426 RenderViewHostDelegateHelper::GetWebkitPrefs(prefs, kIsDomUI); |
| 422 if (extension_host_type_ == ViewType::EXTENSION_POPUP) | 427 if (extension_host_type_ == ViewType::EXTENSION_POPUP) |
| 423 webkit_prefs.allow_scripts_to_close_windows = true; | 428 webkit_prefs.allow_scripts_to_close_windows = true; |
| 424 return webkit_prefs; | 429 return webkit_prefs; |
| 425 } | 430 } |
| 426 | 431 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 window_id = ExtensionTabUtil::GetWindowId( | 601 window_id = ExtensionTabUtil::GetWindowId( |
| 597 const_cast<ExtensionHost* >(this)->GetBrowser()); | 602 const_cast<ExtensionHost* >(this)->GetBrowser()); |
| 598 } else if (extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE) { | 603 } else if (extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE) { |
| 599 // Background page is not attached to any browser window, so pass -1. | 604 // Background page is not attached to any browser window, so pass -1. |
| 600 window_id = -1; | 605 window_id = -1; |
| 601 } else { | 606 } else { |
| 602 NOTREACHED(); | 607 NOTREACHED(); |
| 603 } | 608 } |
| 604 return window_id; | 609 return window_id; |
| 605 } | 610 } |
| OLD | NEW |