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

Side by Side Diff: chrome/browser/extensions/api/streams_private/streams_resource_throttle.cc

Issue 12645004: Add Resource Handler for creating Streams to forward to extensions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Make sure things are called on the right thread. Created 7 years, 9 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 (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 "chrome/browser/extensions/api/streams_private/streams_resource_throttl e.h" 5 #include "chrome/browser/extensions/api/streams_private/streams_resource_throttl e.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 72 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
73 73
74 Profile* profile = GetProfile(render_process_id, render_view_id); 74 Profile* profile = GetProfile(render_process_id, render_view_id);
75 if (!profile) 75 if (!profile)
76 return; 76 return;
77 77
78 // Create the event's arguments value. 78 // Create the event's arguments value.
79 scoped_ptr<ListValue> event_args(new ListValue()); 79 scoped_ptr<ListValue> event_args(new ListValue());
80 event_args->Append(new base::StringValue(mime_type)); 80 event_args->Append(new base::StringValue(mime_type));
81 event_args->Append(new base::StringValue(request_url.spec())); 81 event_args->Append(new base::StringValue(request_url.spec()));
82 event_args->Append(new base::StringValue(request_url.spec()));
82 83
83 scoped_ptr<Event> event(new Event(kOnExecuteMimeTypeHandlerEvent, 84 scoped_ptr<Event> event(new Event(kOnExecuteMimeTypeHandlerEvent,
84 event_args.Pass())); 85 event_args.Pass()));
85 86
86 ExtensionSystem::Get(profile)->event_router()->DispatchEventToExtension( 87 ExtensionSystem::Get(profile)->event_router()->DispatchEventToExtension(
87 extension_id, event.Pass()); 88 extension_id, event.Pass());
88 } 89 }
89 90
90 // Default implementation of StreamsPrivateEventRouter. 91 // Default implementation of StreamsPrivateEventRouter.
91 class StreamsPrivateEventRouterImpl 92 class StreamsPrivateEventRouterImpl
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 190 }
190 191
191 if (CanHandleMimeType(extension, mime_type_)) { 192 if (CanHandleMimeType(extension, mime_type_)) {
192 event_router_->DispatchMimeTypeHandlerEvent(render_process_id_, 193 event_router_->DispatchMimeTypeHandlerEvent(render_process_id_,
193 render_view_id_, mime_type_, request_url_, extension->id()); 194 render_view_id_, mime_type_, request_url_, extension->id());
194 controller()->CancelAndIgnore(); 195 controller()->CancelAndIgnore();
195 return true; 196 return true;
196 } 197 }
197 return false; 198 return false;
198 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698