Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <set> | 5 #include <set> |
| 6 #include <vector> | 6 #include <vector> |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 // before database initialization occurs. | 139 // before database initialization occurs. |
| 140 // | 140 // |
| 141 // However, changing policies at runtime is still not recommended, and | 141 // However, changing policies at runtime is still not recommended, and |
| 142 // likely only should be done for unit tests. | 142 // likely only should be done for unit tests. |
| 143 if (policy_) | 143 if (policy_) |
| 144 policy_->Close(); | 144 policy_->Close(); |
| 145 | 145 |
| 146 switch (policy_type) { | 146 switch (policy_type) { |
| 147 case ActivityLogPolicy::POLICY_FULLSTREAM: | 147 case ActivityLogPolicy::POLICY_FULLSTREAM: |
| 148 policy_ = new FullStreamUIPolicy(profile_); | 148 policy_ = new FullStreamUIPolicy(profile_); |
| 149 break; | |
|
mvrable
2013/07/17 16:41:23
Deleting these lines looks like an accidental edit
karenlees
2013/08/08 23:36:37
Done.
| |
| 150 case ActivityLogPolicy::POLICY_NOARGS: | 149 case ActivityLogPolicy::POLICY_NOARGS: |
| 151 policy_ = new StreamWithoutArgsUIPolicy(profile_); | 150 policy_ = new StreamWithoutArgsUIPolicy(profile_); |
| 152 break; | |
| 153 default: | 151 default: |
| 154 NOTREACHED(); | 152 NOTREACHED(); |
| 155 } | 153 } |
| 154 | |
| 156 policy_type_ = policy_type; | 155 policy_type_ = policy_type; |
| 157 } | 156 } |
| 158 } | 157 } |
| 159 | 158 |
| 160 // Use GetInstance instead of directly creating an ActivityLog. | 159 // Use GetInstance instead of directly creating an ActivityLog. |
| 161 ActivityLog::ActivityLog(Profile* profile) | 160 ActivityLog::ActivityLog(Profile* profile) |
| 162 : policy_(NULL), | 161 : policy_(NULL), |
| 163 policy_type_(ActivityLogPolicy::POLICY_INVALID), | 162 policy_type_(ActivityLogPolicy::POLICY_INVALID), |
| 164 profile_(profile), | 163 profile_(profile), |
| 165 enabled_(false), | 164 enabled_(false), |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 on_url, | 503 on_url, |
| 505 web_contents->GetTitle(), | 504 web_contents->GetTitle(), |
| 506 std::string(), // no api call here | 505 std::string(), // no api call here |
| 507 script_names.get(), | 506 script_names.get(), |
| 508 DomActionType::INSERTED, | 507 DomActionType::INSERTED, |
| 509 extra); | 508 extra); |
| 510 } | 509 } |
| 511 } | 510 } |
| 512 } | 511 } |
| 513 | 512 |
| 513 void ActivityLog::RemoveURLs(const std::vector<GURL>& gurls) { | |
| 514 if (!IsLogEnabled()) { | |
| 515 DLOG(INFO) << "Log not enabled for this profile."; | |
| 516 return; | |
| 517 } | |
| 518 policy_->RemoveURLs(gurls); | |
| 519 } | |
| 520 | |
| 521 void ActivityLog::RemoveURLs(const std::set<GURL>& gurls) { | |
| 522 if (!IsLogEnabled()) { | |
| 523 DLOG(INFO) << "Log not enabled for this profile."; | |
| 524 return; | |
| 525 } | |
| 526 | |
| 527 std::vector<GURL> urls; | |
| 528 for (std::set<GURL>::iterator it = gurls.begin(); it != gurls.end(); ++it) { | |
| 529 urls.push_back(*it); | |
| 530 } | |
| 531 policy_->RemoveURLs(urls); | |
| 532 } | |
| 533 | |
| 534 void ActivityLog::RemoveURL(const GURL& gurl) { | |
| 535 if (!IsLogEnabled()) { | |
| 536 DLOG(INFO) << "Log not enabled for this profile."; | |
| 537 return; | |
| 538 } | |
| 539 policy_->RemoveURL(gurl); | |
| 540 } | |
| 541 | |
| 514 } // namespace extensions | 542 } // namespace extensions |
| OLD | NEW |