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

Side by Side Diff: chrome/common/extensions/extension_localization_peer.cc

Issue 6621006: Take out the is_content_filtered bool that gets passed around betwen renderer... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/common/extensions/extension_localization_peer.h" 5 #include "chrome/common/extensions/extension_localization_peer.h"
6 6
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/common/extensions/extension_message_bundle.h" 9 #include "chrome/common/extensions/extension_message_bundle.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 bool ExtensionLocalizationPeer::OnReceivedRedirect( 48 bool ExtensionLocalizationPeer::OnReceivedRedirect(
49 const GURL& new_url, 49 const GURL& new_url,
50 const webkit_glue::ResourceResponseInfo& info, 50 const webkit_glue::ResourceResponseInfo& info,
51 bool* has_new_first_party_for_cookies, 51 bool* has_new_first_party_for_cookies,
52 GURL* new_first_party_for_cookies) { 52 GURL* new_first_party_for_cookies) {
53 NOTREACHED(); 53 NOTREACHED();
54 return false; 54 return false;
55 } 55 }
56 56
57 void ExtensionLocalizationPeer::OnReceivedResponse( 57 void ExtensionLocalizationPeer::OnReceivedResponse(
58 const webkit_glue::ResourceResponseInfo& info, 58 const webkit_glue::ResourceResponseInfo& info) {
59 bool content_filtered) {
60 response_info_ = info; 59 response_info_ = info;
61 } 60 }
62 61
63 void ExtensionLocalizationPeer::OnReceivedData(const char* data, int len) { 62 void ExtensionLocalizationPeer::OnReceivedData(const char* data, int len) {
64 data_.append(data, len); 63 data_.append(data, len);
65 } 64 }
66 65
67 void ExtensionLocalizationPeer::OnCompletedRequest( 66 void ExtensionLocalizationPeer::OnCompletedRequest(
68 const net::URLRequestStatus& status, 67 const net::URLRequestStatus& status,
69 const std::string& security_info, 68 const std::string& security_info,
70 const base::Time& completion_time) { 69 const base::Time& completion_time) {
71 // Make sure we delete ourselves at the end of this call. 70 // Make sure we delete ourselves at the end of this call.
72 scoped_ptr<ExtensionLocalizationPeer> this_deleter(this); 71 scoped_ptr<ExtensionLocalizationPeer> this_deleter(this);
73 72
74 // Give sub-classes a chance at altering the data. 73 // Give sub-classes a chance at altering the data.
75 if (status.status() != net::URLRequestStatus::SUCCESS) { 74 if (status.status() != net::URLRequestStatus::SUCCESS) {
76 // We failed to load the resource. 75 // We failed to load the resource.
77 original_peer_->OnReceivedResponse(response_info_, true); 76 original_peer_->OnReceivedResponse(response_info_);
78 net::URLRequestStatus status(net::URLRequestStatus::CANCELED, 77 net::URLRequestStatus status(net::URLRequestStatus::CANCELED,
79 net::ERR_ABORTED); 78 net::ERR_ABORTED);
80 original_peer_->OnCompletedRequest(status, security_info, completion_time); 79 original_peer_->OnCompletedRequest(status, security_info, completion_time);
81 return; 80 return;
82 } 81 }
83 82
84 ReplaceMessages(); 83 ReplaceMessages();
85 84
86 original_peer_->OnReceivedResponse(response_info_, true); 85 original_peer_->OnReceivedResponse(response_info_);
87 if (!data_.empty()) 86 if (!data_.empty())
88 original_peer_->OnReceivedData(data_.data(), 87 original_peer_->OnReceivedData(data_.data(),
89 static_cast<int>(data_.size())); 88 static_cast<int>(data_.size()));
90 original_peer_->OnCompletedRequest(status, security_info, completion_time); 89 original_peer_->OnCompletedRequest(status, security_info, completion_time);
91 } 90 }
92 91
93 void ExtensionLocalizationPeer::ReplaceMessages() { 92 void ExtensionLocalizationPeer::ReplaceMessages() {
94 if (!message_sender_ || data_.empty()) 93 if (!message_sender_ || data_.empty())
95 return; 94 return;
96 95
(...skipping 15 matching lines...) Expand all
112 111
113 l10n_messages = GetL10nMessagesMap(extension_id); 112 l10n_messages = GetL10nMessagesMap(extension_id);
114 } 113 }
115 114
116 std::string error; 115 std::string error;
117 if (ExtensionMessageBundle::ReplaceMessagesWithExternalDictionary( 116 if (ExtensionMessageBundle::ReplaceMessagesWithExternalDictionary(
118 *l10n_messages, &data_, &error)) { 117 *l10n_messages, &data_, &error)) {
119 data_.resize(data_.size()); 118 data_.resize(data_.size());
120 } 119 }
121 } 120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698