| 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_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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 | 640 |
| 641 // TODO(mpcomplete): This is duplicated in DidNavigate, which means that | 641 // TODO(mpcomplete): This is duplicated in DidNavigate, which means that |
| 642 // we'll create 2 EFDs for the first navigation. We should try to find a | 642 // we'll create 2 EFDs for the first navigation. We should try to find a |
| 643 // better way to unify them. | 643 // better way to unify them. |
| 644 // See http://code.google.com/p/chromium/issues/detail?id=18240 | 644 // See http://code.google.com/p/chromium/issues/detail?id=18240 |
| 645 LOG(INFO) << "(RenderViewCreated) Resetting EFD to " << url_.spec() << " for " | 645 LOG(INFO) << "(RenderViewCreated) Resetting EFD to " << url_.spec() << " for " |
| 646 << extension_->name(); | 646 << extension_->name(); |
| 647 extension_function_dispatcher_.reset( | 647 extension_function_dispatcher_.reset( |
| 648 new ExtensionFunctionDispatcher(render_view_host, this, url_)); | 648 new ExtensionFunctionDispatcher(render_view_host, this, url_)); |
| 649 | 649 |
| 650 render_view_host->Send(new ViewMsg_EnablePreferredSizeChangedMode( | 650 if (extension_host_type_ == ViewType::EXTENSION_TOOLSTRIP || |
| 651 render_view_host->routing_id())); | 651 extension_host_type_ == ViewType::EXTENSION_MOLE || |
| 652 extension_host_type_ == ViewType::EXTENSION_POPUP) { |
| 653 render_view_host->Send(new ViewMsg_EnablePreferredSizeChangedMode( |
| 654 render_view_host->routing_id())); |
| 655 } |
| 652 } | 656 } |
| 653 | 657 |
| 654 int ExtensionHost::GetBrowserWindowID() const { | 658 int ExtensionHost::GetBrowserWindowID() const { |
| 655 // Hosts not attached to any browser window have an id of -1. This includes | 659 // Hosts not attached to any browser window have an id of -1. This includes |
| 656 // those mentioned below, and background pages. | 660 // those mentioned below, and background pages. |
| 657 int window_id = -1; | 661 int window_id = -1; |
| 658 if (extension_host_type_ == ViewType::EXTENSION_TOOLSTRIP || | 662 if (extension_host_type_ == ViewType::EXTENSION_TOOLSTRIP || |
| 659 extension_host_type_ == ViewType::EXTENSION_MOLE || | 663 extension_host_type_ == ViewType::EXTENSION_MOLE || |
| 660 extension_host_type_ == ViewType::EXTENSION_POPUP) { | 664 extension_host_type_ == ViewType::EXTENSION_POPUP) { |
| 661 // If the host is bound to a browser, then extract its window id. | 665 // If the host is bound to a browser, then extract its window id. |
| 662 // Extensions hosted in ExternalTabContainer objects may not have | 666 // Extensions hosted in ExternalTabContainer objects may not have |
| 663 // an associated browser. | 667 // an associated browser. |
| 664 Browser* browser = GetBrowser(); | 668 Browser* browser = GetBrowser(); |
| 665 if (browser) | 669 if (browser) |
| 666 window_id = ExtensionTabUtil::GetWindowId(browser); | 670 window_id = ExtensionTabUtil::GetWindowId(browser); |
| 667 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { | 671 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { |
| 668 NOTREACHED(); | 672 NOTREACHED(); |
| 669 } | 673 } |
| 670 return window_id; | 674 return window_id; |
| 671 } | 675 } |
| OLD | NEW |