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 // GalleryWatchStateTracker implementation. | 5 // GalleryWatchStateTracker implementation. |
6 | 6 |
7 #include "chrome/browser/extensions/api/media_galleries_private/gallery_watch_st
ate_tracker.h" | 7 #include "chrome/browser/extensions/api/media_galleries_private/gallery_watch_st
ate_tracker.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 if (base::StringToUint64(gallery_id_str, &gallery_id)) | 48 if (base::StringToUint64(gallery_id_str, &gallery_id)) |
49 gallery_ids.insert(gallery_id); | 49 gallery_ids.insert(gallery_id); |
50 } | 50 } |
51 return gallery_ids; | 51 return gallery_ids; |
52 } | 52 } |
53 | 53 |
54 // Converts WatchedGalleryIds to a storage list value. | 54 // Converts WatchedGalleryIds to a storage list value. |
55 scoped_ptr<base::ListValue> WatchedGalleryIdsToValue( | 55 scoped_ptr<base::ListValue> WatchedGalleryIdsToValue( |
56 const chrome::MediaGalleryPrefIdSet gallery_ids) { | 56 const chrome::MediaGalleryPrefIdSet gallery_ids) { |
57 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 57 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
58 scoped_ptr<base::ListValue> list(new ListValue()); | 58 scoped_ptr<base::ListValue> list(new base::ListValue()); |
59 for (chrome::MediaGalleryPrefIdSet::const_iterator id_iter = | 59 for (chrome::MediaGalleryPrefIdSet::const_iterator id_iter = |
60 gallery_ids.begin(); | 60 gallery_ids.begin(); |
61 id_iter != gallery_ids.end(); ++id_iter) | 61 id_iter != gallery_ids.end(); ++id_iter) |
62 list->AppendString(base::Uint64ToString(*id_iter)); | 62 list->AppendString(base::Uint64ToString(*id_iter)); |
63 return list.Pass(); | 63 return list.Pass(); |
64 } | 64 } |
65 | 65 |
66 // Looks up an extension by ID. Does not include disabled extensions. | 66 // Looks up an extension by ID. Does not include disabled extensions. |
67 const Extension* GetExtensionById(Profile* profile, | 67 const Extension* GetExtensionById(Profile* profile, |
68 const std::string& extension_id) { | 68 const std::string& extension_id) { |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 const std::string& extension_id, | 338 const std::string& extension_id, |
339 chrome::MediaGalleryPrefId gallery_id) { | 339 chrome::MediaGalleryPrefId gallery_id) { |
340 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 340 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
341 if (HasGalleryWatchInfo(extension_id, gallery_id, true)) | 341 if (HasGalleryWatchInfo(extension_id, gallery_id, true)) |
342 return false; | 342 return false; |
343 watched_extensions_map_[extension_id][gallery_id] = true; | 343 watched_extensions_map_[extension_id][gallery_id] = true; |
344 return true; | 344 return true; |
345 } | 345 } |
346 | 346 |
347 } // namespace extensions | 347 } // namespace extensions |
OLD | NEW |