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

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

Issue 185663002: Pass http response headers to the streamsPrivate API callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | 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/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 streams_private::StreamInfo info; 48 streams_private::StreamInfo info;
49 info.mime_type = stream->GetMimeType(); 49 info.mime_type = stream->GetMimeType();
50 info.original_url = stream->GetOriginalURL().spec(); 50 info.original_url = stream->GetOriginalURL().spec();
51 info.stream_url = stream->GetURL().spec(); 51 info.stream_url = stream->GetURL().spec();
52 info.tab_id = ExtensionTabUtil::GetTabId(web_contents); 52 info.tab_id = ExtensionTabUtil::GetTabId(web_contents);
53 53
54 int size = -1; 54 int size = -1;
55 if (expected_content_size <= INT_MAX) 55 if (expected_content_size <= INT_MAX)
56 size = expected_content_size; 56 size = expected_content_size;
57 info.expected_content_size = size; 57 info.expected_content_size = size;
58 info.response_headers = stream->GetResponseHeaders();
58 59
59 scoped_ptr<Event> event( 60 scoped_ptr<Event> event(
60 new Event(streams_private::OnExecuteMimeTypeHandler::kEventName, 61 new Event(streams_private::OnExecuteMimeTypeHandler::kEventName,
61 streams_private::OnExecuteMimeTypeHandler::Create(info))); 62 streams_private::OnExecuteMimeTypeHandler::Create(info)));
62 63
63 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension( 64 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension(
64 extension_id, event.Pass()); 65 extension_id, event.Pass());
65 66
66 GURL url = stream->GetURL(); 67 GURL url = stream->GetURL();
67 streams_[extension_id][url] = make_linked_ptr(stream.release()); 68 streams_[extension_id][url] = make_linked_ptr(stream.release());
(...skipping 11 matching lines...) Expand all
79 void StreamsPrivateAPI::Observe(int type, 80 void StreamsPrivateAPI::Observe(int type,
80 const content::NotificationSource& source, 81 const content::NotificationSource& source,
81 const content::NotificationDetails& details) { 82 const content::NotificationDetails& details) {
82 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { 83 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) {
83 const Extension* extension = 84 const Extension* extension =
84 content::Details<const UnloadedExtensionInfo>(details)->extension; 85 content::Details<const UnloadedExtensionInfo>(details)->extension;
85 streams_.erase(extension->id()); 86 streams_.erase(extension->id());
86 } 87 }
87 } 88 }
88 } // namespace extensions 89 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/api/streams_private.idl » ('j') | chrome/common/extensions/api/streams_private.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698