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 "chrome/browser/extensions/activity_log/activity_log.h" | 5 #include "chrome/browser/extensions/activity_log/activity_log.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 switches::kEnableExtensionActivityLogging)) { | 305 switches::kEnableExtensionActivityLogging)) { |
306 db_enabled_ = false; | 306 db_enabled_ = false; |
307 } | 307 } |
308 if (watchdog_app_active_) { | 308 if (watchdog_app_active_) { |
309 watchdog_app_active_ = false; | 309 watchdog_app_active_ = false; |
310 profile_->GetPrefs()->SetBoolean(prefs::kWatchdogExtensionActive, | 310 profile_->GetPrefs()->SetBoolean(prefs::kWatchdogExtensionActive, |
311 false); | 311 false); |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
| 315 void ActivityLog::OnExtensionUninstalled(const Extension* extension) { |
| 316 // If the extension has been uninstalled but not disabled, we delete the |
| 317 // database. |
| 318 if (extension->id() != kActivityLogExtensionId) return; |
| 319 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 320 switches::kEnableExtensionActivityLogging)) { |
| 321 DeleteDatabase(); |
| 322 } |
| 323 } |
| 324 |
315 // static | 325 // static |
316 ActivityLog* ActivityLog::GetInstance(Profile* profile) { | 326 ActivityLog* ActivityLog::GetInstance(Profile* profile) { |
317 return ActivityLogFactory::GetForProfile(profile); | 327 return ActivityLogFactory::GetForProfile(profile); |
318 } | 328 } |
319 | 329 |
320 void ActivityLog::AddObserver(ActivityLog::Observer* observer) { | 330 void ActivityLog::AddObserver(ActivityLog::Observer* observer) { |
321 observers_->AddObserver(observer); | 331 observers_->AddObserver(observer); |
322 } | 332 } |
323 | 333 |
324 void ActivityLog::RemoveObserver(ActivityLog::Observer* observer) { | 334 void ActivityLog::RemoveObserver(ActivityLog::Observer* observer) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 } | 459 } |
450 | 460 |
451 void ActivityLog::RemoveURL(const GURL& url) { | 461 void ActivityLog::RemoveURL(const GURL& url) { |
452 if (url.is_empty()) | 462 if (url.is_empty()) |
453 return; | 463 return; |
454 std::vector<GURL> urls; | 464 std::vector<GURL> urls; |
455 urls.push_back(url); | 465 urls.push_back(url); |
456 RemoveURLs(urls); | 466 RemoveURLs(urls); |
457 } | 467 } |
458 | 468 |
| 469 void ActivityLog::DeleteDatabase() { |
| 470 if (!policy_) |
| 471 return; |
| 472 policy_->DeleteDatabase(); |
| 473 } |
| 474 |
459 } // namespace extensions | 475 } // namespace extensions |
OLD | NEW |