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

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

Issue 10387155: Web Intents: Remove the flag and compile-time define. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 intents_dispatcher_ = NULL; 59 intents_dispatcher_ = NULL;
60 delete this; 60 delete this;
61 } 61 }
62 62
63 void IntentInjector::OnSendReturnMessage( 63 void IntentInjector::OnSendReturnMessage(
64 webkit_glue::WebIntentReplyType reply_type) { 64 webkit_glue::WebIntentReplyType reply_type) {
65 intents_dispatcher_ = NULL; 65 intents_dispatcher_ = NULL;
66 } 66 }
67 67
68 void IntentInjector::RenderViewCreated(RenderViewHost* render_view_host) { 68 void IntentInjector::RenderViewCreated(RenderViewHost* render_view_host) {
69 if (source_intent_.get() == NULL || 69 if (source_intent_.get() == NULL || !web_contents()->GetRenderViewHost())
70 CommandLine::ForCurrentProcess()->HasSwitch(
71 switches::kDisableWebIntents) ||
72 web_contents()->GetRenderViewHost() == NULL) {
73 return; 70 return;
74 }
75 71
76 // Only deliver the intent to the renderer if it has the same origin 72 // Only deliver the intent to the renderer if it has the same origin
77 // as the initial delivery target. 73 // as the initial delivery target.
78 if (initial_url_.GetOrigin() != 74 if (initial_url_.GetOrigin() !=
79 render_view_host->GetSiteInstance()->GetSite().GetOrigin()) { 75 render_view_host->GetSiteInstance()->GetSite().GetOrigin()) {
80 return; 76 return;
81 } 77 }
82 78
83 if (source_intent_->data_type == webkit_glue::WebIntentData::BLOB) { 79 if (source_intent_->data_type == webkit_glue::WebIntentData::BLOB) {
84 // Grant read permission on the blob file to the delivered context. 80 // Grant read permission on the blob file to the delivered context.
(...skipping 10 matching lines...) Expand all
95 bool handled = true; 91 bool handled = true;
96 IPC_BEGIN_MESSAGE_MAP(IntentInjector, message) 92 IPC_BEGIN_MESSAGE_MAP(IntentInjector, message)
97 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentReply, OnReply); 93 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentReply, OnReply);
98 IPC_MESSAGE_UNHANDLED(handled = false) 94 IPC_MESSAGE_UNHANDLED(handled = false)
99 IPC_END_MESSAGE_MAP() 95 IPC_END_MESSAGE_MAP()
100 return handled; 96 return handled;
101 } 97 }
102 98
103 void IntentInjector::OnReply(webkit_glue::WebIntentReplyType reply_type, 99 void IntentInjector::OnReply(webkit_glue::WebIntentReplyType reply_type,
104 const string16& data) { 100 const string16& data) {
105 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebIntents)) 101 if (!intents_dispatcher_)
106 NOTREACHED(); 102 return;
107 103
108 if (intents_dispatcher_) { 104 // Ensure SendReplyMessage is only called once.
109 // Ensure we only call SendReplyMessage once. 105 content::WebIntentsDispatcher* intents_dispatcher = intents_dispatcher_;
110 content::WebIntentsDispatcher* intents_dispatcher = intents_dispatcher_; 106 intents_dispatcher_ = NULL;
111 intents_dispatcher_ = NULL; 107 intents_dispatcher->SendReplyMessage(reply_type, data);
112 intents_dispatcher->SendReplyMessage(reply_type, data);
113 }
114 } 108 }
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_intents_table_unittest.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698