OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/extensions/extension_localization_peer.h" | 5 #include "chrome/renderer/extensions/extension_localization_peer.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // static | 48 // static |
49 ExtensionLocalizationPeer* | 49 ExtensionLocalizationPeer* |
50 ExtensionLocalizationPeer::CreateExtensionLocalizationPeer( | 50 ExtensionLocalizationPeer::CreateExtensionLocalizationPeer( |
51 content::RequestPeer* peer, | 51 content::RequestPeer* peer, |
52 IPC::Sender* message_sender, | 52 IPC::Sender* message_sender, |
53 const std::string& mime_type, | 53 const std::string& mime_type, |
54 const GURL& request_url) { | 54 const GURL& request_url) { |
55 // Return NULL if content is not text/css or it doesn't belong to extension | 55 // Return NULL if content is not text/css or it doesn't belong to extension |
56 // scheme. | 56 // scheme. |
57 return (request_url.SchemeIs(extensions::kExtensionScheme) && | 57 return (request_url.SchemeIs(extensions::kExtensionScheme) && |
58 base::StartsWithASCII(mime_type, "text/css", false)) | 58 base::StartsWith(mime_type, "text/css", |
| 59 base::CompareCase::INSENSITIVE_ASCII)) |
59 ? new ExtensionLocalizationPeer(peer, message_sender, request_url) | 60 ? new ExtensionLocalizationPeer(peer, message_sender, request_url) |
60 : NULL; | 61 : NULL; |
61 } | 62 } |
62 | 63 |
63 void ExtensionLocalizationPeer::OnUploadProgress( | 64 void ExtensionLocalizationPeer::OnUploadProgress( |
64 uint64 position, uint64 size) { | 65 uint64 position, uint64 size) { |
65 NOTREACHED(); | 66 NOTREACHED(); |
66 } | 67 } |
67 | 68 |
68 bool ExtensionLocalizationPeer::OnReceivedRedirect( | 69 bool ExtensionLocalizationPeer::OnReceivedRedirect( |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 137 |
137 l10n_messages = extensions::GetL10nMessagesMap(extension_id); | 138 l10n_messages = extensions::GetL10nMessagesMap(extension_id); |
138 } | 139 } |
139 | 140 |
140 std::string error; | 141 std::string error; |
141 if (extensions::MessageBundle::ReplaceMessagesWithExternalDictionary( | 142 if (extensions::MessageBundle::ReplaceMessagesWithExternalDictionary( |
142 *l10n_messages, &data_, &error)) { | 143 *l10n_messages, &data_, &error)) { |
143 data_.resize(data_.size()); | 144 data_.resize(data_.size()); |
144 } | 145 } |
145 } | 146 } |
OLD | NEW |