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

Side by Side Diff: chrome/browser/guest_view/extension_options/extension_options_guest.cc

Issue 497843002: GuestViews should be able to specify task manager entries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added DEPS Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/guest_view/extension_options/extension_options_guest.h" 5 #include "chrome/browser/guest_view/extension_options/extension_options_guest.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
9 #include "chrome/browser/extensions/extension_tab_util.h" 9 #include "chrome/browser/extensions/extension_tab_util.h"
10 #include "chrome/browser/guest_view/extension_options/extension_options_constant s.h" 10 #include "chrome/browser/guest_view/extension_options/extension_options_constant s.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_finder.h" 13 #include "chrome/browser/ui/browser_finder.h"
14 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
16 #include "chrome/common/extensions/api/extension_options_internal.h" 16 #include "chrome/common/extensions/api/extension_options_internal.h"
17 #include "chrome/common/extensions/manifest_url_handler.h" 17 #include "chrome/common/extensions/manifest_url_handler.h"
18 #include "components/crx_file/id_util.h" 18 #include "components/crx_file/id_util.h"
19 #include "content/public/browser/render_process_host.h" 19 #include "content/public/browser/render_process_host.h"
20 #include "content/public/browser/site_instance.h" 20 #include "content/public/browser/site_instance.h"
21 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
22 #include "extensions/browser/extension_function_dispatcher.h" 22 #include "extensions/browser/extension_function_dispatcher.h"
23 #include "extensions/browser/extension_registry.h" 23 #include "extensions/browser/extension_registry.h"
24 #include "extensions/browser/guest_view/guest_view_manager.h" 24 #include "extensions/browser/guest_view/guest_view_manager.h"
25 #include "extensions/common/extension.h" 25 #include "extensions/common/extension.h"
26 #include "extensions/common/extension_messages.h" 26 #include "extensions/common/extension_messages.h"
27 #include "extensions/common/feature_switch.h" 27 #include "extensions/common/feature_switch.h"
28 #include "extensions/common/permissions/permissions_data.h" 28 #include "extensions/common/permissions/permissions_data.h"
29 #include "extensions/strings/grit/extensions_strings.h"
29 #include "ipc/ipc_message_macros.h" 30 #include "ipc/ipc_message_macros.h"
30 31
31 using content::WebContents; 32 using content::WebContents;
32 using namespace extensions::api; 33 using namespace extensions::api;
33 34
34 // static 35 // static
35 const char ExtensionOptionsGuest::Type[] = "extensionoptions"; 36 const char ExtensionOptionsGuest::Type[] = "extensionoptions";
36 37
37 ExtensionOptionsGuest::ExtensionOptionsGuest( 38 ExtensionOptionsGuest::ExtensionOptionsGuest(
38 content::BrowserContext* browser_context, 39 content::BrowserContext* browser_context,
39 int guest_instance_id) 40 int guest_instance_id)
40 : GuestView<ExtensionOptionsGuest>(browser_context, guest_instance_id) { 41 : GuestView<ExtensionOptionsGuest>(browser_context, guest_instance_id) {
41 } 42 }
42 43
43 ExtensionOptionsGuest::~ExtensionOptionsGuest() { 44 ExtensionOptionsGuest::~ExtensionOptionsGuest() {
44 } 45 }
45 46
46 const char* ExtensionOptionsGuest::GetAPINamespace() {
47 return extensionoptions::kAPINamespace;
48 }
49
50 // static 47 // static
51 extensions::GuestViewBase* ExtensionOptionsGuest::Create( 48 extensions::GuestViewBase* ExtensionOptionsGuest::Create(
52 content::BrowserContext* browser_context, 49 content::BrowserContext* browser_context,
53 int guest_instance_id) { 50 int guest_instance_id) {
54 if (!extensions::FeatureSwitch::embedded_extension_options()->IsEnabled()) { 51 if (!extensions::FeatureSwitch::embedded_extension_options()->IsEnabled()) {
55 return NULL; 52 return NULL;
56 } 53 }
57 return new ExtensionOptionsGuest(browser_context, guest_instance_id); 54 return new ExtensionOptionsGuest(browser_context, guest_instance_id);
58 } 55 }
59 56
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 guest_web_contents()); 118 guest_web_contents());
122 } 119 }
123 120
124 void ExtensionOptionsGuest::DidStopLoading() { 121 void ExtensionOptionsGuest::DidStopLoading() {
125 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 122 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
126 DispatchEventToEmbedder(new extensions::GuestViewBase::Event( 123 DispatchEventToEmbedder(new extensions::GuestViewBase::Event(
127 extensions::api::extension_options_internal::OnLoad::kEventName, 124 extensions::api::extension_options_internal::OnLoad::kEventName,
128 args.Pass())); 125 args.Pass()));
129 } 126 }
130 127
128 const char* ExtensionOptionsGuest::GetAPINamespace() const {
129 return extensionoptions::kAPINamespace;
130 }
131
132 int ExtensionOptionsGuest::GetTaskPrefix() const {
133 return IDS_EXTENSION_TASK_MANAGER_EXTENSIONOPTIONS_TAG_PREFIX;
134 }
135
131 content::WebContents* ExtensionOptionsGuest::GetAssociatedWebContents() const { 136 content::WebContents* ExtensionOptionsGuest::GetAssociatedWebContents() const {
132 return guest_web_contents(); 137 return guest_web_contents();
133 } 138 }
134 139
135 bool ExtensionOptionsGuest::OnMessageReceived(const IPC::Message& message) { 140 bool ExtensionOptionsGuest::OnMessageReceived(const IPC::Message& message) {
136 bool handled = true; 141 bool handled = true;
137 IPC_BEGIN_MESSAGE_MAP(ExtensionOptionsGuest, message) 142 IPC_BEGIN_MESSAGE_MAP(ExtensionOptionsGuest, message)
138 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) 143 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
139 IPC_MESSAGE_UNHANDLED(handled = false) 144 IPC_MESSAGE_UNHANDLED(handled = false)
140 IPC_END_MESSAGE_MAP() 145 IPC_END_MESSAGE_MAP()
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 content::OpenURLParams params(target_url, 216 content::OpenURLParams params(target_url,
212 content::Referrer(), 217 content::Referrer(),
213 NEW_FOREGROUND_TAB, 218 NEW_FOREGROUND_TAB,
214 content::PAGE_TRANSITION_LINK, 219 content::PAGE_TRANSITION_LINK,
215 false); 220 false);
216 browser->OpenURL(params); 221 browser->OpenURL(params);
217 // TODO(ericzeng): Open the tab in the background if the click was a 222 // TODO(ericzeng): Open the tab in the background if the click was a
218 // ctrl-click or middle mouse button click 223 // ctrl-click or middle mouse button click
219 return false; 224 return false;
220 } 225 }
OLDNEW
« no previous file with comments | « chrome/browser/guest_view/extension_options/extension_options_guest.h ('k') | chrome/browser/task_manager/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698