Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 10113005: Remove EPM:all_hosts_ and use all_extension_views_ instead. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comments addressed Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 #include <utility> 7 #include <utility>
8 8
9 #include "chrome/browser/tab_contents/render_view_context_menu.h" 9 #include "chrome/browser/tab_contents/render_view_context_menu.h"
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "chrome/app/chrome_command_ids.h" 18 #include "chrome/app/chrome_command_ids.h"
19 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 19 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
20 #include "chrome/browser/autocomplete/autocomplete_edit.h" 20 #include "chrome/browser/autocomplete/autocomplete_edit.h"
21 #include "chrome/browser/autocomplete/autocomplete_match.h" 21 #include "chrome/browser/autocomplete/autocomplete_match.h"
22 #include "chrome/browser/browser_process.h" 22 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/debugger/devtools_window.h" 23 #include "chrome/browser/debugger/devtools_window.h"
24 #include "chrome/browser/download/download_service.h" 24 #include "chrome/browser/download/download_service.h"
25 #include "chrome/browser/download/download_service_factory.h" 25 #include "chrome/browser/download/download_service_factory.h"
26 #include "chrome/browser/download/download_util.h" 26 #include "chrome/browser/download/download_util.h"
27 #include "chrome/browser/extensions/extension_event_router.h"
28 #include "chrome/browser/extensions/extension_host.h"
29 #include "chrome/browser/extensions/extension_service.h" 27 #include "chrome/browser/extensions/extension_service.h"
28 #include "chrome/browser/extensions/extension_system.h"
30 #include "chrome/browser/google/google_util.h" 29 #include "chrome/browser/google/google_util.h"
31 #include "chrome/browser/net/browser_url_util.h" 30 #include "chrome/browser/net/browser_url_util.h"
32 #include "chrome/browser/prefs/incognito_mode_prefs.h" 31 #include "chrome/browser/prefs/incognito_mode_prefs.h"
33 #include "chrome/browser/prefs/pref_member.h" 32 #include "chrome/browser/prefs/pref_member.h"
34 #include "chrome/browser/prefs/pref_service.h" 33 #include "chrome/browser/prefs/pref_service.h"
35 #include "chrome/browser/printing/print_preview_context_menu_observer.h" 34 #include "chrome/browser/printing/print_preview_context_menu_observer.h"
36 #include "chrome/browser/printing/print_preview_tab_controller.h" 35 #include "chrome/browser/printing/print_preview_tab_controller.h"
37 #include "chrome/browser/printing/print_view_manager.h" 36 #include "chrome/browser/printing/print_view_manager.h"
38 #include "chrome/browser/profiles/profile.h" 37 #include "chrome/browser/profiles/profile.h"
39 #include "chrome/browser/profiles/profile_io_data.h" 38 #include "chrome/browser/profiles/profile_io_data.h"
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 if (!print_preview_menu_observer_.get()) { 616 if (!print_preview_menu_observer_.get()) {
618 TabContentsWrapper* wrapper = 617 TabContentsWrapper* wrapper =
619 TabContentsWrapper::GetCurrentWrapperForContents(source_web_contents_); 618 TabContentsWrapper::GetCurrentWrapperForContents(source_web_contents_);
620 print_preview_menu_observer_.reset( 619 print_preview_menu_observer_.reset(
621 new PrintPreviewContextMenuObserver(wrapper)); 620 new PrintPreviewContextMenuObserver(wrapper));
622 } 621 }
623 observers_.AddObserver(print_preview_menu_observer_.get()); 622 observers_.AddObserver(print_preview_menu_observer_.get());
624 } 623 }
625 624
626 const Extension* RenderViewContextMenu::GetExtension() const { 625 const Extension* RenderViewContextMenu::GetExtension() const {
627 ExtensionProcessManager* process_manager = 626 ExtensionSystem* system = ExtensionSystem::Get(profile_);
628 profile_->GetExtensionProcessManager();
629 // There is no process manager in some tests. 627 // There is no process manager in some tests.
630 if (!process_manager) { 628 if (!system->process_manager())
631 return NULL; 629 return NULL;
632 }
633 630
634 ExtensionProcessManager::const_iterator iter; 631 return system->process_manager()->GetExtensionForRenderViewHost(
635 for (iter = process_manager->begin(); iter != process_manager->end(); 632 source_web_contents_->GetRenderViewHost());
636 ++iter) {
637 ExtensionHost* host = *iter;
638 if (host->host_contents() == source_web_contents_)
639 return host->extension();
640 }
641
642 return NULL;
643 } 633 }
644 634
645 void RenderViewContextMenu::AppendPlatformAppItems( 635 void RenderViewContextMenu::AppendPlatformAppItems(
646 const Extension* platform_app) { 636 const Extension* platform_app) {
647 DCHECK(platform_app); 637 DCHECK(platform_app);
648 int index = 0; 638 int index = 0;
649 AppendExtensionItems(platform_app->id(), &index); 639 AppendExtensionItems(platform_app->id(), &index);
650 640
651 // Add dev tools for unpacked extensions. 641 // Add dev tools for unpacked extensions.
652 if (platform_app->location() == Extension::LOAD) { 642 if (platform_app->location() == Extension::LOAD) {
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after
1983 source_web_contents_->GetRenderViewHost()-> 1973 source_web_contents_->GetRenderViewHost()->
1984 ExecuteMediaPlayerActionAtLocation(location, action); 1974 ExecuteMediaPlayerActionAtLocation(location, action);
1985 } 1975 }
1986 1976
1987 void RenderViewContextMenu::PluginActionAt( 1977 void RenderViewContextMenu::PluginActionAt(
1988 const gfx::Point& location, 1978 const gfx::Point& location,
1989 const WebPluginAction& action) { 1979 const WebPluginAction& action) {
1990 source_web_contents_->GetRenderViewHost()-> 1980 source_web_contents_->GetRenderViewHost()->
1991 ExecutePluginActionAtLocation(location, action); 1981 ExecutePluginActionAtLocation(location, action);
1992 } 1982 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698