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

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

Issue 263513004: Forward MIME types to BrowserPlugin when a viewer is specified. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unittests Created 6 years, 6 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 "chrome/browser/extensions/api/streams_private/streams_private_api.h" 5 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/extension_tab_util.h" 9 #include "chrome/browser/extensions/extension_tab_util.h"
10 #include "chrome/common/extensions/api/streams_private.h" 10 #include "chrome/common/extensions/api/streams_private.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_)); 54 extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_));
55 } 55 }
56 56
57 StreamsPrivateAPI::~StreamsPrivateAPI() { 57 StreamsPrivateAPI::~StreamsPrivateAPI() {
58 } 58 }
59 59
60 void StreamsPrivateAPI::ExecuteMimeTypeHandler( 60 void StreamsPrivateAPI::ExecuteMimeTypeHandler(
61 const std::string& extension_id, 61 const std::string& extension_id,
62 content::WebContents* web_contents, 62 content::WebContents* web_contents,
63 scoped_ptr<content::StreamHandle> stream, 63 scoped_ptr<content::StreamHandle> stream,
64 const std::string& view_id,
64 int64 expected_content_size) { 65 int64 expected_content_size) {
65 // Create the event's arguments value. 66 // Create the event's arguments value.
66 streams_private::StreamInfo info; 67 streams_private::StreamInfo info;
67 info.mime_type = stream->GetMimeType(); 68 info.mime_type = stream->GetMimeType();
68 info.original_url = stream->GetOriginalURL().spec(); 69 info.original_url = stream->GetOriginalURL().spec();
69 info.stream_url = stream->GetURL().spec(); 70 info.stream_url = stream->GetURL().spec();
70 info.tab_id = ExtensionTabUtil::GetTabId(web_contents); 71 info.tab_id = ExtensionTabUtil::GetTabId(web_contents);
71 72
73 if (!view_id.empty()) {
74 info.view_id.reset(new std::string(view_id));
75 }
76
72 int size = -1; 77 int size = -1;
73 if (expected_content_size <= INT_MAX) 78 if (expected_content_size <= INT_MAX)
74 size = expected_content_size; 79 size = expected_content_size;
75 info.expected_content_size = size; 80 info.expected_content_size = size;
76 81
77 CreateResponseHeadersDictionary(stream->GetResponseHeaders().get(), 82 CreateResponseHeadersDictionary(stream->GetResponseHeaders().get(),
78 &info.response_headers.additional_properties); 83 &info.response_headers.additional_properties);
79 84
80 scoped_ptr<Event> event( 85 scoped_ptr<Event> event(
81 new Event(streams_private::OnExecuteMimeTypeHandler::kEventName, 86 new Event(streams_private::OnExecuteMimeTypeHandler::kEventName,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> > 140 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> >
136 g_factory = LAZY_INSTANCE_INITIALIZER; 141 g_factory = LAZY_INSTANCE_INITIALIZER;
137 142
138 // static 143 // static
139 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* 144 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>*
140 StreamsPrivateAPI::GetFactoryInstance() { 145 StreamsPrivateAPI::GetFactoryInstance() {
141 return g_factory.Pointer(); 146 return g_factory.Pointer();
142 } 147 }
143 148
144 } // namespace extensions 149 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/streams_private/streams_private_api.h ('k') | chrome/browser/extensions/plugin_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698