OLD | NEW |
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 StreamsPrivateAPI::~StreamsPrivateAPI() { | 46 StreamsPrivateAPI::~StreamsPrivateAPI() { |
47 } | 47 } |
48 | 48 |
49 void StreamsPrivateAPI::ExecuteMimeTypeHandler( | 49 void StreamsPrivateAPI::ExecuteMimeTypeHandler( |
50 const std::string& extension_id, | 50 const std::string& extension_id, |
51 const content::WebContents* web_contents, | 51 const content::WebContents* web_contents, |
52 scoped_ptr<content::StreamHandle> stream, | 52 scoped_ptr<content::StreamHandle> stream, |
53 int64 expected_content_size) { | 53 int64 expected_content_size) { |
54 // Create the event's arguments value. | 54 // Create the event's arguments value. |
55 scoped_ptr<ListValue> event_args(new ListValue()); | 55 scoped_ptr<base::ListValue> event_args(new base::ListValue()); |
56 event_args->Append(new base::StringValue(stream->GetMimeType())); | 56 event_args->Append(new base::StringValue(stream->GetMimeType())); |
57 event_args->Append(new base::StringValue(stream->GetOriginalURL().spec())); | 57 event_args->Append(new base::StringValue(stream->GetOriginalURL().spec())); |
58 event_args->Append(new base::StringValue(stream->GetURL().spec())); | 58 event_args->Append(new base::StringValue(stream->GetURL().spec())); |
59 event_args->Append( | 59 event_args->Append( |
60 new base::FundamentalValue(ExtensionTabUtil::GetTabId(web_contents))); | 60 new base::FundamentalValue(ExtensionTabUtil::GetTabId(web_contents))); |
61 | 61 |
62 int size = -1; | 62 int size = -1; |
63 if (expected_content_size <= INT_MAX) | 63 if (expected_content_size <= INT_MAX) |
64 size = expected_content_size; | 64 size = expected_content_size; |
65 event_args->Append(new base::FundamentalValue(size)); | 65 event_args->Append(new base::FundamentalValue(size)); |
(...skipping 20 matching lines...) Expand all Loading... |
86 void StreamsPrivateAPI::Observe(int type, | 86 void StreamsPrivateAPI::Observe(int type, |
87 const content::NotificationSource& source, | 87 const content::NotificationSource& source, |
88 const content::NotificationDetails& details) { | 88 const content::NotificationDetails& details) { |
89 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { | 89 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { |
90 const Extension* extension = | 90 const Extension* extension = |
91 content::Details<const UnloadedExtensionInfo>(details)->extension; | 91 content::Details<const UnloadedExtensionInfo>(details)->extension; |
92 streams_.erase(extension->id()); | 92 streams_.erase(extension->id()); |
93 } | 93 } |
94 } | 94 } |
95 } // namespace extensions | 95 } // namespace extensions |
OLD | NEW |