| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" | 29 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" |
| 30 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| 31 #include "chrome/common/chrome_notification_types.h" | 31 #include "chrome/common/chrome_notification_types.h" |
| 32 #include "chrome/common/extensions/extension.h" | 32 #include "chrome/common/extensions/extension.h" |
| 33 #include "chrome/common/extensions/extension_constants.h" | 33 #include "chrome/common/extensions/extension_constants.h" |
| 34 #include "chrome/common/extensions/extension_messages.h" | 34 #include "chrome/common/extensions/extension_messages.h" |
| 35 #include "chrome/common/render_messages.h" | 35 #include "chrome/common/render_messages.h" |
| 36 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
| 37 #include "chrome/common/chrome_view_types.h" | 37 #include "chrome/common/chrome_view_types.h" |
| 38 #include "content/browser/browsing_instance.h" | 38 #include "content/browser/browsing_instance.h" |
| 39 #include "content/browser/renderer_host/browser_render_process_host.h" | |
| 40 #include "content/browser/renderer_host/render_process_host.h" | |
| 41 #include "content/browser/renderer_host/render_view_host.h" | 39 #include "content/browser/renderer_host/render_view_host.h" |
| 42 #include "content/browser/renderer_host/render_widget_host.h" | 40 #include "content/browser/renderer_host/render_widget_host.h" |
| 43 #include "content/browser/renderer_host/render_widget_host_view.h" | 41 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 44 #include "content/browser/site_instance.h" | 42 #include "content/browser/site_instance.h" |
| 45 #include "content/browser/tab_contents/popup_menu_helper_mac.h" | 43 #include "content/browser/tab_contents/popup_menu_helper_mac.h" |
| 46 #include "content/browser/tab_contents/tab_contents.h" | 44 #include "content/browser/tab_contents/tab_contents.h" |
| 47 #include "content/browser/tab_contents/tab_contents_view.h" | 45 #include "content/browser/tab_contents/tab_contents_view.h" |
| 48 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
| 49 #include "content/common/view_messages.h" | 47 #include "content/common/view_messages.h" |
| 50 #include "content/public/browser/content_browser_client.h" | 48 #include "content/public/browser/content_browser_client.h" |
| 51 #include "content/public/browser/native_web_keyboard_event.h" | 49 #include "content/public/browser/native_web_keyboard_event.h" |
| 50 #include "content/public/browser/render_process_host.h" |
| 52 #include "content/public/common/bindings_policy.h" | 51 #include "content/public/common/bindings_policy.h" |
| 53 #include "grit/browser_resources.h" | 52 #include "grit/browser_resources.h" |
| 54 #include "grit/chromium_strings.h" | 53 #include "grit/chromium_strings.h" |
| 55 #include "grit/generated_resources.h" | 54 #include "grit/generated_resources.h" |
| 56 #include "ui/base/keycodes/keyboard_codes.h" | 55 #include "ui/base/keycodes/keyboard_codes.h" |
| 57 #include "ui/base/l10n/l10n_util.h" | 56 #include "ui/base/l10n/l10n_util.h" |
| 58 #include "ui/base/resource/resource_bundle.h" | 57 #include "ui/base/resource/resource_bundle.h" |
| 59 #include "webkit/glue/context_menu.h" | 58 #include "webkit/glue/context_menu.h" |
| 60 | 59 |
| 61 #if defined(TOOLKIT_VIEWS) | 60 #if defined(TOOLKIT_VIEWS) |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 GetAssociatedTabContents(), | 593 GetAssociatedTabContents(), |
| 595 params); | 594 params); |
| 596 } | 595 } |
| 597 | 596 |
| 598 void ExtensionHost::CreateNewWindow( | 597 void ExtensionHost::CreateNewWindow( |
| 599 int route_id, | 598 int route_id, |
| 600 const ViewHostMsg_CreateWindow_Params& params) { | 599 const ViewHostMsg_CreateWindow_Params& params) { |
| 601 // TODO(aa): Use the browser's profile if the extension is split mode | 600 // TODO(aa): Use the browser's profile if the extension is split mode |
| 602 // incognito. | 601 // incognito. |
| 603 Profile* profile = Profile::FromBrowserContext( | 602 Profile* profile = Profile::FromBrowserContext( |
| 604 render_view_host()->process()->browser_context()); | 603 render_view_host()->process()->GetBrowserContext()); |
| 605 TabContents* new_contents = delegate_view_helper_.CreateNewWindow( | 604 TabContents* new_contents = delegate_view_helper_.CreateNewWindow( |
| 606 route_id, | 605 route_id, |
| 607 profile, | 606 profile, |
| 608 site_instance(), | 607 site_instance(), |
| 609 ChromeWebUIFactory::GetInstance()->GetWebUIType( | 608 ChromeWebUIFactory::GetInstance()->GetWebUIType( |
| 610 render_view_host()->process()->browser_context(), url_), | 609 render_view_host()->process()->GetBrowserContext(), url_), |
| 611 this, | 610 this, |
| 612 params.window_container_type, | 611 params.window_container_type, |
| 613 params.frame_name); | 612 params.frame_name); |
| 614 | 613 |
| 615 TabContents* associated_contents = GetAssociatedTabContents(); | 614 TabContents* associated_contents = GetAssociatedTabContents(); |
| 616 if (associated_contents && associated_contents->delegate()) | 615 if (associated_contents && associated_contents->delegate()) |
| 617 associated_contents->delegate()->TabContentsCreated(new_contents); | 616 associated_contents->delegate()->TabContentsCreated(new_contents); |
| 618 } | 617 } |
| 619 | 618 |
| 620 void ExtensionHost::CreateNewWidget(int route_id, | 619 void ExtensionHost::CreateNewWidget(int route_id, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); | 798 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); |
| 800 } | 799 } |
| 801 } | 800 } |
| 802 | 801 |
| 803 void ExtensionHost::RenderViewReady(RenderViewHost* render_view_host) { | 802 void ExtensionHost::RenderViewReady(RenderViewHost* render_view_host) { |
| 804 content::NotificationService::current()->Notify( | 803 content::NotificationService::current()->Notify( |
| 805 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, | 804 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, |
| 806 content::Source<Profile>(profile_), | 805 content::Source<Profile>(profile_), |
| 807 content::Details<ExtensionHost>(this)); | 806 content::Details<ExtensionHost>(this)); |
| 808 } | 807 } |
| OLD | NEW |