| 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 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/common/render_messages.h" | 30 #include "chrome/common/render_messages.h" |
| 31 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
| 32 #include "chrome/common/chrome_view_types.h" | 32 #include "chrome/common/chrome_view_types.h" |
| 33 #include "content/browser/browsing_instance.h" | 33 #include "content/browser/browsing_instance.h" |
| 34 #include "content/browser/renderer_host/browser_render_process_host.h" | 34 #include "content/browser/renderer_host/browser_render_process_host.h" |
| 35 #include "content/browser/renderer_host/render_process_host.h" | 35 #include "content/browser/renderer_host/render_process_host.h" |
| 36 #include "content/browser/renderer_host/render_view_host.h" | 36 #include "content/browser/renderer_host/render_view_host.h" |
| 37 #include "content/browser/tab_contents/tab_contents.h" | 37 #include "content/browser/tab_contents/tab_contents.h" |
| 38 #include "content/browser/tab_contents/tab_contents_view.h" | 38 #include "content/browser/tab_contents/tab_contents_view.h" |
| 39 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
| 40 #include "content/common/view_messages.h" | |
| 41 #include "content/public/browser/content_browser_client.h" | 40 #include "content/public/browser/content_browser_client.h" |
| 42 #include "content/public/browser/native_web_keyboard_event.h" | 41 #include "content/public/browser/native_web_keyboard_event.h" |
| 43 #include "grit/browser_resources.h" | 42 #include "grit/browser_resources.h" |
| 44 #include "grit/chromium_strings.h" | 43 #include "grit/chromium_strings.h" |
| 45 #include "grit/generated_resources.h" | 44 #include "grit/generated_resources.h" |
| 46 #include "ui/base/keycodes/keyboard_codes.h" | 45 #include "ui/base/keycodes/keyboard_codes.h" |
| 47 #include "ui/base/l10n/l10n_util.h" | 46 #include "ui/base/l10n/l10n_util.h" |
| 48 #include "ui/base/resource/resource_bundle.h" | 47 #include "ui/base/resource/resource_bundle.h" |
| 49 | 48 |
| 50 #if defined(TOOLKIT_VIEWS) | 49 #if defined(TOOLKIT_VIEWS) |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 void ExtensionHost::OnRequest(const ExtensionHostMsg_Request_Params& params) { | 418 void ExtensionHost::OnRequest(const ExtensionHostMsg_Request_Params& params) { |
| 420 extension_function_dispatcher_.Dispatch(params, render_view_host()); | 419 extension_function_dispatcher_.Dispatch(params, render_view_host()); |
| 421 } | 420 } |
| 422 | 421 |
| 423 void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { | 422 void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { |
| 424 if (view_.get()) | 423 if (view_.get()) |
| 425 view_->RenderViewCreated(); | 424 view_->RenderViewCreated(); |
| 426 | 425 |
| 427 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || | 426 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || |
| 428 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { | 427 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { |
| 429 render_view_host->EnablePreferredSizeMode( | 428 render_view_host->EnablePreferredSizeMode(); |
| 430 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); | |
| 431 } | 429 } |
| 432 | 430 |
| 433 // If the host is bound to a browser, then extract its window id. | 431 // If the host is bound to a browser, then extract its window id. |
| 434 // Extensions hosted in ExternalTabContainer objects may not have | 432 // Extensions hosted in ExternalTabContainer objects may not have |
| 435 // an associated browser. | 433 // an associated browser. |
| 436 const Browser* browser = GetBrowser(); | 434 const Browser* browser = GetBrowser(); |
| 437 if (browser) { | 435 if (browser) { |
| 438 render_view_host->Send(new ExtensionMsg_UpdateBrowserWindowId( | 436 render_view_host->Send(new ExtensionMsg_UpdateBrowserWindowId( |
| 439 render_view_host->routing_id(), | 437 render_view_host->routing_id(), |
| 440 ExtensionTabUtil::GetWindowId(browser))); | 438 ExtensionTabUtil::GetWindowId(browser))); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 browser->AddTabContents(contents, disposition, initial_pos, user_gesture); | 504 browser->AddTabContents(contents, disposition, initial_pos, user_gesture); |
| 507 } | 505 } |
| 508 | 506 |
| 509 | 507 |
| 510 void ExtensionHost::RenderViewReady() { | 508 void ExtensionHost::RenderViewReady() { |
| 511 content::NotificationService::current()->Notify( | 509 content::NotificationService::current()->Notify( |
| 512 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, | 510 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, |
| 513 content::Source<Profile>(profile_), | 511 content::Source<Profile>(profile_), |
| 514 content::Details<ExtensionHost>(this)); | 512 content::Details<ExtensionHost>(this)); |
| 515 } | 513 } |
| OLD | NEW |