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

Side by Side Diff: content/browser/intents/intent_injector.cc

Issue 9113095: Revert 119284 - Turn web intents build flag on. Move the command-line flag to default on. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 11 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 | Annotate | Revision Log
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 "content/browser/intents/intent_injector.h" 5 #include "content/browser/intents/intent_injector.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "content/browser/renderer_host/render_view_host.h" 10 #include "content/browser/renderer_host/render_view_host.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 // TODO(gbillock): The "correct" thing here is for this to be a 61 // TODO(gbillock): The "correct" thing here is for this to be a
62 // RenderViewHostObserver, and do this on RenderViewHostInitialized. There's no 62 // RenderViewHostObserver, and do this on RenderViewHostInitialized. There's no
63 // good hooks for attaching the intent to such an object, though. All RVHOs get 63 // good hooks for attaching the intent to such an object, though. All RVHOs get
64 // made deep inside tab contents initialization. Idea: propagate out 64 // made deep inside tab contents initialization. Idea: propagate out
65 // RenderViewHostInitialized to a WebContentsObserver latch? That still looks 65 // RenderViewHostInitialized to a WebContentsObserver latch? That still looks
66 // like it might be racy, though. 66 // like it might be racy, though.
67 void IntentInjector::SendIntent() { 67 void IntentInjector::SendIntent() {
68 if (source_intent_.get() == NULL || 68 if (source_intent_.get() == NULL ||
69 CommandLine::ForCurrentProcess()->HasSwitch( 69 !CommandLine::ForCurrentProcess()->HasSwitch(
70 switches::kDisableWebIntents) || 70 switches::kEnableWebIntents) ||
71 web_contents()->GetRenderViewHost() == NULL) { 71 web_contents()->GetRenderViewHost() == NULL) {
72 return; 72 return;
73 } 73 }
74 74
75 // Send intent data through to renderer. 75 // Send intent data through to renderer.
76 web_contents()->GetRenderViewHost()->Send(new IntentsMsg_SetWebIntentData( 76 web_contents()->GetRenderViewHost()->Send(new IntentsMsg_SetWebIntentData(
77 web_contents()->GetRenderViewHost()->routing_id(), 77 web_contents()->GetRenderViewHost()->routing_id(),
78 *(source_intent_.get()))); 78 *(source_intent_.get())));
79 source_intent_.reset(NULL); 79 source_intent_.reset(NULL);
80 } 80 }
81 81
82 bool IntentInjector::OnMessageReceived(const IPC::Message& message) { 82 bool IntentInjector::OnMessageReceived(const IPC::Message& message) {
83 bool handled = true; 83 bool handled = true;
84 IPC_BEGIN_MESSAGE_MAP(IntentInjector, message) 84 IPC_BEGIN_MESSAGE_MAP(IntentInjector, message)
85 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentReply, OnReply); 85 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentReply, OnReply);
86 IPC_MESSAGE_UNHANDLED(handled = false) 86 IPC_MESSAGE_UNHANDLED(handled = false)
87 IPC_END_MESSAGE_MAP() 87 IPC_END_MESSAGE_MAP()
88 return handled; 88 return handled;
89 } 89 }
90 90
91 void IntentInjector::OnReply(webkit_glue::WebIntentReplyType reply_type, 91 void IntentInjector::OnReply(webkit_glue::WebIntentReplyType reply_type,
92 const string16& data) { 92 const string16& data) {
93 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebIntents)) 93 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents))
94 NOTREACHED(); 94 NOTREACHED();
95 95
96 if (intents_dispatcher_) { 96 if (intents_dispatcher_) {
97 intents_dispatcher_->SendReplyMessage(reply_type, data); 97 intents_dispatcher_->SendReplyMessage(reply_type, data);
98 } 98 }
99 } 99 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_manifests_unittest.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698