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

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: Code review fixes Created 6 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 "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 const content::WebContents* web_contents, 62 const 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
72 if (view_id.empty()) {
73 info.tab_id.reset(new int(ExtensionTabUtil::GetTabId(web_contents)));
not at google - send to devlin 2014/04/30 15:42:43 with regards to my previous comment, it's a little
Zachary Kuznia 2014/05/01 00:38:22 I'll go the route of always setting it.
74 } else {
75 info.view_id.reset(new std::string(view_id));
76 }
71 77
72 int size = -1; 78 int size = -1;
73 if (expected_content_size <= INT_MAX) 79 if (expected_content_size <= INT_MAX)
74 size = expected_content_size; 80 size = expected_content_size;
75 info.expected_content_size = size; 81 info.expected_content_size = size;
76 82
77 CreateResponseHeadersDictionary(stream->GetResponseHeaders().get(), 83 CreateResponseHeadersDictionary(stream->GetResponseHeaders().get(),
78 &info.response_headers.additional_properties); 84 &info.response_headers.additional_properties);
79 85
80 scoped_ptr<Event> event( 86 scoped_ptr<Event> event(
(...skipping 17 matching lines...) Expand all
98 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> > 104 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> >
99 g_factory = LAZY_INSTANCE_INITIALIZER; 105 g_factory = LAZY_INSTANCE_INITIALIZER;
100 106
101 // static 107 // static
102 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* 108 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>*
103 StreamsPrivateAPI::GetFactoryInstance() { 109 StreamsPrivateAPI::GetFactoryInstance() {
104 return g_factory.Pointer(); 110 return g_factory.Pointer();
105 } 111 }
106 112
107 } // namespace extensions 113 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698