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

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

Issue 1026383003: <webview>: make context menus cancellable using JS API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments from yoz@ Created 5 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 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 5
6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h" 6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h"
7 7
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/favicon/favicon_tab_helper.h" 9 #include "chrome/browser/favicon/favicon_tab_helper.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 pending_menu_ = menu_delegate->BuildMenu(guest_web_contents(), params); 47 pending_menu_ = menu_delegate->BuildMenu(guest_web_contents(), params);
48 48
49 // Pass it to embedder. 49 // Pass it to embedder.
50 int request_id = ++pending_context_menu_request_id_; 50 int request_id = ++pending_context_menu_request_id_;
51 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 51 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
52 scoped_ptr<base::ListValue> items = 52 scoped_ptr<base::ListValue> items =
53 MenuModelToValue(pending_menu_->menu_model()); 53 MenuModelToValue(pending_menu_->menu_model());
54 args->Set(webview::kContextMenuItems, items.release()); 54 args->Set(webview::kContextMenuItems, items.release());
55 args->SetInteger(webview::kRequestId, request_id); 55 args->SetInteger(webview::kRequestId, request_id);
56 web_view_guest()->DispatchEventToView( 56 web_view_guest()->DispatchEventToView(
57 new GuestViewBase::Event(webview::kEventContextMenu, args.Pass())); 57 new GuestViewBase::Event(webview::kEventContextMenuShow, args.Pass()));
58 return true; 58 return true;
59 } 59 }
60 60
61 // TODO(hanxi) Investigate which of these observers should move to the 61 // TODO(hanxi) Investigate which of these observers should move to the
62 // extension module in the future. 62 // extension module in the future.
63 void ChromeWebViewGuestDelegate::OnAttachWebViewHelpers( 63 void ChromeWebViewGuestDelegate::OnAttachWebViewHelpers(
64 content::WebContents* contents) { 64 content::WebContents* contents) {
65 FaviconTabHelper::CreateForWebContents(contents); 65 FaviconTabHelper::CreateForWebContents(contents);
66 ChromeExtensionWebContentsObserver::CreateForWebContents(contents); 66 ChromeExtensionWebContentsObserver::CreateForWebContents(contents);
67 #if defined(ENABLE_PRINTING) 67 #if defined(ENABLE_PRINTING)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) { 167 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) {
168 if (details.enabled) 168 if (details.enabled)
169 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost()); 169 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost());
170 else 170 else
171 chromevox_injected_ = false; 171 chromevox_injected_ = false;
172 } 172 }
173 } 173 }
174 #endif 174 #endif
175 175
176 } // namespace extensions 176 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/apps/guest_view/web_view_browsertest.cc ('k') | chrome/common/extensions/api/chrome_web_view_internal.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698