OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser/extensions/activity_log/activity_actions.h" | 5 #include "chrome/browser/extensions/activity_log/activity_actions.h" |
6 | 6 |
7 #include <algorithm> // for std::find. | 7 #include <algorithm> // for std::find. |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 173 matching lines...) Loading... |
184 other_.reset(new base::DictionaryValue()); | 184 other_.reset(new base::DictionaryValue()); |
185 } | 185 } |
186 return other_.get(); | 186 return other_.get(); |
187 } | 187 } |
188 | 188 |
189 std::string Action::SerializePageUrl() const { | 189 std::string Action::SerializePageUrl() const { |
190 return (page_incognito() ? constants::kIncognitoUrl : "") + page_url().spec(); | 190 return (page_incognito() ? constants::kIncognitoUrl : "") + page_url().spec(); |
191 } | 191 } |
192 | 192 |
193 void Action::ParsePageUrl(const std::string& url) { | 193 void Action::ParsePageUrl(const std::string& url) { |
194 set_page_incognito( | 194 set_page_incognito(base::StartsWith(url, constants::kIncognitoUrl, |
195 base::StartsWithASCII(url, constants::kIncognitoUrl, true)); | 195 base::CompareCase::SENSITIVE)); |
196 if (page_incognito()) | 196 if (page_incognito()) |
197 set_page_url(GURL(url.substr(strlen(constants::kIncognitoUrl)))); | 197 set_page_url(GURL(url.substr(strlen(constants::kIncognitoUrl)))); |
198 else | 198 else |
199 set_page_url(GURL(url)); | 199 set_page_url(GURL(url)); |
200 } | 200 } |
201 | 201 |
202 std::string Action::SerializeArgUrl() const { | 202 std::string Action::SerializeArgUrl() const { |
203 return (arg_incognito() ? constants::kIncognitoUrl : "") + arg_url().spec(); | 203 return (arg_incognito() ? constants::kIncognitoUrl : "") + arg_url().spec(); |
204 } | 204 } |
205 | 205 |
206 void Action::ParseArgUrl(const std::string& url) { | 206 void Action::ParseArgUrl(const std::string& url) { |
207 set_arg_incognito(base::StartsWithASCII(url, constants::kIncognitoUrl, true)); | 207 set_arg_incognito(base::StartsWith(url, constants::kIncognitoUrl, |
| 208 base::CompareCase::SENSITIVE)); |
208 if (arg_incognito()) | 209 if (arg_incognito()) |
209 set_arg_url(GURL(url.substr(strlen(constants::kIncognitoUrl)))); | 210 set_arg_url(GURL(url.substr(strlen(constants::kIncognitoUrl)))); |
210 else | 211 else |
211 set_arg_url(GURL(url)); | 212 set_arg_url(GURL(url)); |
212 } | 213 } |
213 | 214 |
214 scoped_ptr<ExtensionActivity> Action::ConvertToExtensionActivity() { | 215 scoped_ptr<ExtensionActivity> Action::ConvertToExtensionActivity() { |
215 scoped_ptr<ExtensionActivity> result(new ExtensionActivity); | 216 scoped_ptr<ExtensionActivity> result(new ExtensionActivity); |
216 | 217 |
217 // We do this translation instead of using the same enum because the database | 218 // We do this translation instead of using the same enum because the database |
(...skipping 336 matching lines...) Loading... |
554 std::string rhs_other = ActivityLogPolicy::Util::Serialize(rhs->other()); | 555 std::string rhs_other = ActivityLogPolicy::Util::Serialize(rhs->other()); |
555 if (lhs_other != rhs_other) | 556 if (lhs_other != rhs_other) |
556 return lhs_other < rhs_other; | 557 return lhs_other < rhs_other; |
557 } | 558 } |
558 | 559 |
559 // All fields compare as equal if this point is reached. | 560 // All fields compare as equal if this point is reached. |
560 return false; | 561 return false; |
561 } | 562 } |
562 | 563 |
563 } // namespace extensions | 564 } // namespace extensions |
OLD | NEW |