OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/media_galleries/fileapi/picasa_data_provider.h" | 5 #include "chrome/browser/media_galleries/fileapi/picasa_data_provider.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence(); | 44 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence(); |
45 | 45 |
46 StartFilePathWatchOnMediaTaskRunner( | 46 StartFilePathWatchOnMediaTaskRunner( |
47 database_path_.DirName().AppendASCII(kPicasaTempDirName), | 47 database_path_.DirName().AppendASCII(kPicasaTempDirName), |
48 base::Bind(&PicasaDataProvider::OnTempDirWatchStarted, | 48 base::Bind(&PicasaDataProvider::OnTempDirWatchStarted, |
49 weak_factory_.GetWeakPtr()), | 49 weak_factory_.GetWeakPtr()), |
50 base::Bind(&PicasaDataProvider::OnTempDirChanged, | 50 base::Bind(&PicasaDataProvider::OnTempDirChanged, |
51 weak_factory_.GetWeakPtr())); | 51 weak_factory_.GetWeakPtr())); |
52 } | 52 } |
53 | 53 |
54 PicasaDataProvider::~PicasaDataProvider() { | 54 PicasaDataProvider::~PicasaDataProvider() {} |
55 StopFilePathWatchOnMediaTaskRunner(std::move(temp_dir_watcher_)); | |
56 } | |
57 | 55 |
58 void PicasaDataProvider::RefreshData(DataType needed_data, | 56 void PicasaDataProvider::RefreshData(DataType needed_data, |
59 const ReadyCallback& ready_callback) { | 57 const ReadyCallback& ready_callback) { |
60 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence(); | 58 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence(); |
61 // TODO(tommycli): Need to watch the database_path_ folder and handle | 59 // TODO(tommycli): Need to watch the database_path_ folder and handle |
62 // rereading the data when it changes. | 60 // rereading the data when it changes. |
63 | 61 |
64 if (state_ == INVALID_DATA_STATE) { | 62 if (state_ == INVALID_DATA_STATE) { |
65 ready_callback.Run(false /* success */); | 63 ready_callback.Run(false /* success */); |
66 return; | 64 return; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 if (total_counts[name] != 1) { | 258 if (total_counts[name] != 1) { |
261 name = base::StringPrintf("%s (%d)", name.c_str(), | 259 name = base::StringPrintf("%s (%d)", name.c_str(), |
262 ++current_counts[name]); | 260 ++current_counts[name]); |
263 } | 261 } |
264 | 262 |
265 result_map->insert(std::pair<std::string, AlbumInfo>(name, info_list[i])); | 263 result_map->insert(std::pair<std::string, AlbumInfo>(name, info_list[i])); |
266 } | 264 } |
267 } | 265 } |
268 | 266 |
269 } // namespace picasa | 267 } // namespace picasa |
OLD | NEW |