Chromium Code Reviews| Index: chrome/browser/tab_contents/render_view_context_menu.cc |
| diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc |
| index 2e3fa8a868c33a26a135ccad3c4dc2e6be6e8f91..cbddacec35ffaaa32286992caebb29cd8782794c 100644 |
| --- a/chrome/browser/tab_contents/render_view_context_menu.cc |
| +++ b/chrome/browser/tab_contents/render_view_context_menu.cc |
| @@ -24,6 +24,7 @@ |
| #include "chrome/browser/download/download_service.h" |
| #include "chrome/browser/download/download_service_factory.h" |
| #include "chrome/browser/extensions/extension_event_router.h" |
| +#include "chrome/browser/extensions/extension_host.h" |
| #include "chrome/browser/extensions/extension_service.h" |
| #include "chrome/browser/google/google_util.h" |
| #include "chrome/browser/net/browser_url_util.h" |
| @@ -48,13 +49,12 @@ |
| #include "chrome/browser/translate/translate_tab_helper.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
| -#include "chrome/browser/ui/browser_list.h" |
| #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
| #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| -#include "chrome/browser/web_applications/web_app.h" |
| #include "chrome/common/chrome_constants.h" |
| #include "chrome/common/chrome_notification_types.h" |
| #include "chrome/common/chrome_switches.h" |
| +#include "chrome/common/extensions/extension.h" |
| #include "chrome/common/pref_names.h" |
| #include "chrome/common/print_messages.h" |
| #include "chrome/common/spellcheck_messages.h" |
| @@ -518,17 +518,18 @@ void RenderViewContextMenu::InitMenu() { |
| bool has_link = !params_.unfiltered_link_url.is_empty(); |
| bool has_selection = !params_.selection_text.empty(); |
| - Browser* active_browser = BrowserList::FindBrowserWithTabContents( |
| - source_tab_contents_); |
| - if (active_browser && active_browser->is_app()) { |
| - const std::string ext_id = web_app::GetExtensionIdFromApplicationName( |
| - active_browser->app_name()); |
| - const Extension* app = |
| - profile_->GetExtensionService()->GetInstalledExtension(ext_id); |
| - if (app && app->is_platform_app()) { |
| - int index = 0; |
| - AppendExtensionItems(app->id(), &index); |
| - return; |
| + ExtensionProcessManager* process_manager = |
| + profile_->GetExtensionProcessManager(); |
| + ExtensionProcessManager::const_iterator iter; |
| + for (iter = process_manager->begin(); iter != process_manager->end(); |
| + ++iter) { |
| + ExtensionHost* host = *iter; |
| + if (host->host_contents() == source_tab_contents_) { |
| + if (host->extension() && host->extension()->is_platform_app()) { |
| + int index = 0; |
| + AppendExtensionItems(host->extension()->id(), &index); |
| + return; |
|
miket_OOO
2011/12/20 19:12:34
This early return scares me in an Init method, par
Mihai Parparita -not on Chrome
2012/01/04 22:46:46
I've cleaned things up a bit, so that platform app
|
| + } |
| } |
| } |