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

Side by Side Diff: chrome/browser/renderer_host/chrome_render_view_host_observer.cc

Issue 8834008: Hide default context menu for platform apps. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer_host/chrome_render_view_host_observer.h" 5 #include "chrome/browser/renderer_host/chrome_render_view_host_observer.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/dom_operation_notification_details.h" 8 #include "chrome/browser/dom_operation_notification_details.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/net/predictor.h" 10 #include "chrome/browser/net/predictor.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/chrome_notification_types.h" 12 #include "chrome/common/chrome_notification_types.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/extensions/extension_messages.h" 14 #include "chrome/common/extensions/extension_messages.h"
15 #include "chrome/common/render_messages.h" 15 #include "chrome/common/render_messages.h"
16 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
17 #include "content/browser/browsing_instance.h" 17 #include "content/browser/browsing_instance.h"
18 #include "content/browser/child_process_security_policy.h" 18 #include "content/browser/child_process_security_policy.h"
19 #include "content/browser/renderer_host/render_view_host_delegate.h" 19 #include "content/browser/renderer_host/render_view_host_delegate.h"
20 #include "content/browser/renderer_host/render_view_host.h" 20 #include "content/browser/renderer_host/render_view_host.h"
21 #include "content/browser/site_instance.h" 21 #include "content/browser/site_instance.h"
22 #include "content/common/view_messages.h"
22 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
23 24
24 ChromeRenderViewHostObserver::ChromeRenderViewHostObserver( 25 ChromeRenderViewHostObserver::ChromeRenderViewHostObserver(
25 RenderViewHost* render_view_host, chrome_browser_net::Predictor* predictor) 26 RenderViewHost* render_view_host, chrome_browser_net::Predictor* predictor)
26 : content::RenderViewHostObserver(render_view_host), 27 : content::RenderViewHostObserver(render_view_host),
27 predictor_(predictor) { 28 predictor_(predictor) {
28 SiteInstance* site_instance = render_view_host->site_instance(); 29 SiteInstance* site_instance = render_view_host->site_instance();
29 profile_ = Profile::FromBrowserContext( 30 profile_ = Profile::FromBrowserContext(
30 site_instance->browsing_instance()->browser_context()); 31 site_instance->browsing_instance()->browser_context());
31 32
(...skipping 25 matching lines...) Expand all
57 bool ChromeRenderViewHostObserver::OnMessageReceived( 58 bool ChromeRenderViewHostObserver::OnMessageReceived(
58 const IPC::Message& message) { 59 const IPC::Message& message) {
59 bool handled = true; 60 bool handled = true;
60 IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewHostObserver, message) 61 IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewHostObserver, message)
61 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DomOperationResponse, 62 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DomOperationResponse,
62 OnDomOperationResponse) 63 OnDomOperationResponse)
63 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusedEditableNodeTouched, 64 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusedEditableNodeTouched,
64 OnFocusedEditableNodeTouched) 65 OnFocusedEditableNodeTouched)
65 IPC_MESSAGE_UNHANDLED(handled = false) 66 IPC_MESSAGE_UNHANDLED(handled = false)
66 IPC_END_MESSAGE_MAP() 67 IPC_END_MESSAGE_MAP()
68
69 if (message.type() == ViewHostMsg_ContextMenu::ID) {
Mihai Parparita -not on Chrome 2011/12/08 03:34:52 Blocking this at the IPC level doesn't seem quite
70 const Extension* extension = GetExtension();
71 if (extension && extension->is_platform_app())
72 handled = true;
73 }
74
67 return handled; 75 return handled;
68 } 76 }
69 77
70 void ChromeRenderViewHostObserver::InitRenderViewHostForExtensions() { 78 void ChromeRenderViewHostObserver::InitRenderViewHostForExtensions() {
71 const Extension* extension = GetExtension(); 79 const Extension* extension = GetExtension();
72 if (!extension) 80 if (!extension)
73 return; 81 return;
74 82
75 ExtensionProcessManager* process_manager = 83 ExtensionProcessManager* process_manager =
76 profile_->GetExtensionProcessManager(); 84 profile_->GetExtensionProcessManager();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 content::Source<RenderViewHost>(render_view_host()), 179 content::Source<RenderViewHost>(render_view_host()),
172 content::Details<DomOperationNotificationDetails>(&details)); 180 content::Details<DomOperationNotificationDetails>(&details));
173 } 181 }
174 182
175 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() { 183 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() {
176 content::NotificationService::current()->Notify( 184 content::NotificationService::current()->Notify(
177 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED, 185 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED,
178 content::Source<RenderViewHost>(render_view_host()), 186 content::Source<RenderViewHost>(render_view_host()),
179 content::NotificationService::NoDetails()); 187 content::NotificationService::NoDetails());
180 } 188 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698