| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/api/downloads/downloads_api.h" | 5 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cctype> | 8 #include <cctype> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 } | 524 } |
| 525 | 525 |
| 526 class ExtensionDownloadsEventRouterData : public base::SupportsUserData::Data { | 526 class ExtensionDownloadsEventRouterData : public base::SupportsUserData::Data { |
| 527 public: | 527 public: |
| 528 static ExtensionDownloadsEventRouterData* Get(DownloadItem* download_item) { | 528 static ExtensionDownloadsEventRouterData* Get(DownloadItem* download_item) { |
| 529 base::SupportsUserData::Data* data = download_item->GetUserData(kKey); | 529 base::SupportsUserData::Data* data = download_item->GetUserData(kKey); |
| 530 return (data == NULL) ? NULL : | 530 return (data == NULL) ? NULL : |
| 531 static_cast<ExtensionDownloadsEventRouterData*>(data); | 531 static_cast<ExtensionDownloadsEventRouterData*>(data); |
| 532 } | 532 } |
| 533 | 533 |
| 534 explicit ExtensionDownloadsEventRouterData( | 534 ExtensionDownloadsEventRouterData( |
| 535 DownloadItem* download_item, | 535 DownloadItem* download_item, |
| 536 scoped_ptr<base::DictionaryValue> json_item) | 536 scoped_ptr<base::DictionaryValue> json_item) |
| 537 : updated_(0), | 537 : updated_(0), |
| 538 changed_fired_(0), | 538 changed_fired_(0), |
| 539 json_(json_item.Pass()) { | 539 json_(json_item.Pass()) { |
| 540 download_item->SetUserData(kKey, this); | 540 download_item->SetUserData(kKey, this); |
| 541 } | 541 } |
| 542 | 542 |
| 543 virtual ~ExtensionDownloadsEventRouterData() { | 543 virtual ~ExtensionDownloadsEventRouterData() { |
| 544 if (updated_ > 0) { | 544 if (updated_ > 0) { |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 if (profile_->HasOffTheRecordProfile() && | 1047 if (profile_->HasOffTheRecordProfile() && |
| 1048 !profile_->IsOffTheRecord()) { | 1048 !profile_->IsOffTheRecord()) { |
| 1049 DispatchEventInternal( | 1049 DispatchEventInternal( |
| 1050 profile_->GetOffTheRecordProfile(), | 1050 profile_->GetOffTheRecordProfile(), |
| 1051 event_name, | 1051 event_name, |
| 1052 json_args, | 1052 json_args, |
| 1053 scoped_ptr<base::ListValue>(args->DeepCopy())); | 1053 scoped_ptr<base::ListValue>(args->DeepCopy())); |
| 1054 } | 1054 } |
| 1055 DispatchEventInternal(profile_, event_name, json_args, args.Pass()); | 1055 DispatchEventInternal(profile_, event_name, json_args, args.Pass()); |
| 1056 } | 1056 } |
| OLD | NEW |