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

Side by Side Diff: extensions/browser/guest_view/app_view/app_view_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: More cleanup 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 "extensions/browser/guest_view/app_view/app_view_guest.h" 5 #include "extensions/browser/guest_view/app_view/app_view_guest.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/public/browser/render_view_host.h" 8 #include "content/public/browser/render_view_host.h"
9 #include "content/public/common/renderer_preferences.h" 9 #include "content/public/common/renderer_preferences.h"
10 #include "extensions/browser/api/app_runtime/app_runtime_api.h" 10 #include "extensions/browser/api/app_runtime/app_runtime_api.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 extensions::switches::kEnableAppView)) { 95 extensions::switches::kEnableAppView)) {
96 return NULL; 96 return NULL;
97 } 97 }
98 return new AppViewGuest(browser_context, guest_instance_id); 98 return new AppViewGuest(browser_context, guest_instance_id);
99 } 99 }
100 100
101 AppViewGuest::AppViewGuest(content::BrowserContext* browser_context, 101 AppViewGuest::AppViewGuest(content::BrowserContext* browser_context,
102 int guest_instance_id) 102 int guest_instance_id)
103 : GuestView<AppViewGuest>(browser_context, guest_instance_id), 103 : GuestView<AppViewGuest>(browser_context, guest_instance_id),
104 app_view_guest_delegate_( 104 app_view_guest_delegate_(
105 ExtensionsAPIClient::Get()->CreateAppViewGuestDelegate()), 105 ExtensionsAPIClient::Get()->CreateAppViewGuestDelegate(this)),
106 weak_ptr_factory_(this) { 106 weak_ptr_factory_(this) {
107 } 107 }
108 108
109 AppViewGuest::~AppViewGuest() { 109 AppViewGuest::~AppViewGuest() {
110 } 110 }
111 111
112 WindowController* AppViewGuest::GetExtensionWindowController() const { 112 WindowController* AppViewGuest::GetExtensionWindowController() const {
113 return NULL; 113 return NULL;
114 } 114 }
115 115
(...skipping 11 matching lines...) Expand all
127 } 127 }
128 128
129 bool AppViewGuest::HandleContextMenu(const content::ContextMenuParams& params) { 129 bool AppViewGuest::HandleContextMenu(const content::ContextMenuParams& params) {
130 if (app_view_guest_delegate_) { 130 if (app_view_guest_delegate_) {
131 return app_view_guest_delegate_->HandleContextMenu(guest_web_contents(), 131 return app_view_guest_delegate_->HandleContextMenu(guest_web_contents(),
132 params); 132 params);
133 } 133 }
134 return false; 134 return false;
135 } 135 }
136 136
137 const char* AppViewGuest::GetAPINamespace() { 137 const char* AppViewGuest::GetAPINamespace() const {
138 return appview::kEmbedderAPINamespace; 138 return appview::kEmbedderAPINamespace;
139 } 139 }
140 140
141 int AppViewGuest::GetTaskPrefix() const {
142 if (!app_view_guest_delegate_)
143 return 0;
Charlie Reis 2014/08/25 20:25:41 Maybe IDS_TASK_MANAGER_APPVIEW_TAG_PREFIX by defau
Fady Samuel 2014/08/25 23:05:52 Done.
144 return app_view_guest_delegate_->GetTaskPrefix();
145 }
146
141 void AppViewGuest::CreateWebContents( 147 void AppViewGuest::CreateWebContents(
142 const std::string& embedder_extension_id, 148 const std::string& embedder_extension_id,
143 int embedder_render_process_id, 149 int embedder_render_process_id,
144 const base::DictionaryValue& create_params, 150 const base::DictionaryValue& create_params,
145 const WebContentsCreatedCallback& callback) { 151 const WebContentsCreatedCallback& callback) {
146 std::string app_id; 152 std::string app_id;
147 if (!create_params.GetString(appview::kAppID, &app_id)) { 153 if (!create_params.GetString(appview::kAppID, &app_id)) {
148 callback.Run(NULL); 154 callback.Run(NULL);
149 return; 155 return;
150 } 156 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 254
249 scoped_ptr<base::DictionaryValue> embed_request(new base::DictionaryValue()); 255 scoped_ptr<base::DictionaryValue> embed_request(new base::DictionaryValue());
250 embed_request->SetInteger(appview::kGuestInstanceID, guest_instance_id()); 256 embed_request->SetInteger(appview::kGuestInstanceID, guest_instance_id());
251 embed_request->SetString(appview::kEmbedderID, embedder_extension_id()); 257 embed_request->SetString(appview::kEmbedderID, embedder_extension_id());
252 embed_request->Set(appview::kData, data.release()); 258 embed_request->Set(appview::kData, data.release());
253 AppRuntimeEventRouter::DispatchOnEmbedRequestedEvent( 259 AppRuntimeEventRouter::DispatchOnEmbedRequestedEvent(
254 browser_context(), embed_request.Pass(), extension_host->extension()); 260 browser_context(), embed_request.Pass(), extension_host->extension());
255 } 261 }
256 262
257 } // namespace extensions 263 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698