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

Side by Side Diff: chrome/browser/guest_view/web_view/web_view_guest.cc

Issue 258373002: Towards moving guest management to chrome: Introduce GuestViewManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android build Created 6 years, 7 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/web_view/web_view_guest.h" 5 #include "chrome/browser/guest_view/web_view/web_view_guest.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/extensions/api/web_request/web_request_api.h" 10 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( 125 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents(
126 contents); 126 contents);
127 #if defined(ENABLE_PLUGINS) 127 #if defined(ENABLE_PLUGINS)
128 PluginPermissionHelper::CreateForWebContents(contents); 128 PluginPermissionHelper::CreateForWebContents(contents);
129 #endif 129 #endif
130 } 130 }
131 131
132 } // namespace 132 } // namespace
133 133
134 WebViewGuest::WebViewGuest(WebContents* guest_web_contents, 134 WebViewGuest::WebViewGuest(WebContents* guest_web_contents,
135 const std::string& extension_id) 135 const std::string& embedder_extension_id,
136 : GuestView<WebViewGuest>(guest_web_contents, extension_id), 136 const base::WeakPtr<GuestViewBase>& opener)
137 : GuestView<WebViewGuest>(guest_web_contents,
138 embedder_extension_id,
139 opener),
137 WebContentsObserver(guest_web_contents), 140 WebContentsObserver(guest_web_contents),
138 script_executor_(new extensions::ScriptExecutor(guest_web_contents, 141 script_executor_(new extensions::ScriptExecutor(guest_web_contents,
139 &script_observers_)), 142 &script_observers_)),
140 current_context_menu_request_id_(0), 143 current_context_menu_request_id_(0),
141 next_permission_request_id_(0), 144 next_permission_request_id_(0),
142 is_overriding_user_agent_(false), 145 is_overriding_user_agent_(false),
143 pending_reload_on_attachment_(false), 146 pending_reload_on_attachment_(false),
144 main_frame_id_(0), 147 main_frame_id_(0),
145 chromevox_injected_(false), 148 chromevox_injected_(false),
146 find_helper_(this), 149 find_helper_(this),
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 309
307 scoped_ptr<RenderViewContextMenu> menu = 310 scoped_ptr<RenderViewContextMenu> menu =
308 menu_delegate->BuildMenu(guest_web_contents(), params); 311 menu_delegate->BuildMenu(guest_web_contents(), params);
309 312
310 // Pass it to embedder. 313 // Pass it to embedder.
311 int request_id = ++current_context_menu_request_id_; 314 int request_id = ++current_context_menu_request_id_;
312 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 315 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
313 scoped_ptr<base::ListValue> items = MenuModelToValue(menu->menu_model()); 316 scoped_ptr<base::ListValue> items = MenuModelToValue(menu->menu_model());
314 args->Set(webview::kContextMenuItems, items.release()); 317 args->Set(webview::kContextMenuItems, items.release());
315 args->SetInteger(webview::kRequestId, request_id); 318 args->SetInteger(webview::kRequestId, request_id);
316 DispatchEvent(new GuestView::Event(webview::kEventContextMenu, args.Pass())); 319 DispatchEvent(new GuestViewBase::Event(webview::kEventContextMenu,
320 args.Pass()));
317 321
318 menu_delegate->ShowMenu(menu.Pass()); 322 menu_delegate->ShowMenu(menu.Pass());
319 return true; 323 return true;
320 } 324 }
321 325
322 void WebViewGuest::AddMessageToConsole(int32 level, 326 void WebViewGuest::AddMessageToConsole(int32 level,
323 const base::string16& message, 327 const base::string16& message,
324 int32 line_no, 328 int32 line_no,
325 const base::string16& source_id) { 329 const base::string16& source_id) {
326 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 330 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 const PermissionResponseCallback& callback, 1059 const PermissionResponseCallback& callback,
1056 BrowserPluginPermissionType permission_type, 1060 BrowserPluginPermissionType permission_type,
1057 bool allowed_by_default) 1061 bool allowed_by_default)
1058 : callback(callback), 1062 : callback(callback),
1059 permission_type(permission_type), 1063 permission_type(permission_type),
1060 allowed_by_default(allowed_by_default) { 1064 allowed_by_default(allowed_by_default) {
1061 } 1065 }
1062 1066
1063 WebViewGuest::PermissionResponseInfo::~PermissionResponseInfo() { 1067 WebViewGuest::PermissionResponseInfo::~PermissionResponseInfo() {
1064 } 1068 }
OLDNEW
« no previous file with comments | « chrome/browser/guest_view/web_view/web_view_guest.h ('k') | chrome/browser/profiles/off_the_record_profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698