Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: chrome/browser/media_galleries/media_galleries_preferences.cc

Issue 23513059: Media Galleries API Picasa: End-to-end browsertest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/media_galleries/media_galleries_preferences.h" 5 #include "chrome/browser/media_galleries/media_galleries_preferences.h"
6 6
7 #include "base/base_paths_posix.h" 7 #include "base/base_paths_posix.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/i18n/time_formatting.h" 9 #include "base/i18n/time_formatting.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 368 }
369 369
370 on_initialize_callbacks_.push_back(callback); 370 on_initialize_callbacks_.push_back(callback);
371 if (on_initialize_callbacks_.size() > 1) 371 if (on_initialize_callbacks_.size() > 1)
372 return; 372 return;
373 373
374 // This counter must match the number of async methods dispatched below. 374 // This counter must match the number of async methods dispatched below.
375 // It cannot be incremented inline with each callback, as some may return 375 // It cannot be incremented inline with each callback, as some may return
376 // synchronously, decrement the counter to 0, and prematurely trigger 376 // synchronously, decrement the counter to 0, and prematurely trigger
377 // FinishInitialization. 377 // FinishInitialization.
378 pre_initialization_callbacks_waiting_ = 2; 378 pre_initialization_callbacks_waiting_ = 3;
379 379
380 // We determine the freshness of the profile here, before any of the finders 380 // We determine the freshness of the profile here, before any of the finders
381 // return and add media galleries to it. 381 // return and add media galleries to it.
382 bool need_to_add_default_galleries = APIHasBeenUsed(profile_); 382 bool need_to_add_default_galleries = APIHasBeenUsed(profile_);
383 StorageMonitor::GetInstance()->EnsureInitialized( 383 StorageMonitor::GetInstance()->EnsureInitialized(
384 base::Bind(&MediaGalleriesPreferences::OnStorageMonitorInit, 384 base::Bind(&MediaGalleriesPreferences::OnStorageMonitorInit,
385 weak_factory_.GetWeakPtr(), need_to_add_default_galleries)); 385 weak_factory_.GetWeakPtr(), need_to_add_default_galleries));
386 386
387 // Look for optional default galleries every time. 387 // Look for optional default galleries every time.
388 itunes::ITunesFinder::FindITunesLibrary( 388 itunes::ITunesFinder::FindITunesLibrary(
389 base::Bind(&MediaGalleriesPreferences::OnFinderDeviceID, 389 base::Bind(&MediaGalleriesPreferences::OnFinderDeviceID,
390 weak_factory_.GetWeakPtr())); 390 weak_factory_.GetWeakPtr()));
391 391
392 picasa::FindPicasaDatabase(
393 base::Bind(&MediaGalleriesPreferences::OnFinderDeviceID,
394 weak_factory_.GetWeakPtr()));
395
392 #if 0 396 #if 0
393 iphoto::FindIPhotoLibrary( 397 iphoto::FindIPhotoLibrary(
394 base::Bind(&MediaGalleriesPreferences::OnFinderDeviceID, 398 base::Bind(&MediaGalleriesPreferences::OnFinderDeviceID,
395 weak_factory_.GetWeakPtr())); 399 weak_factory_.GetWeakPtr()));
396 #endif 400 #endif
397
398 // TODO(tommycli): Turn on when Picasa code is ready.
399 #if 0
400 picasa::PicasaFinder::FindPicasaDatabaseOnUIThread(
401 base::Bind(&MediaGalleriesPreferences::OnFinderDeviceID,
402 weak_factory_.GetWeakPtr()));
403 #endif
404 } 401 }
405 402
406 bool MediaGalleriesPreferences::IsInitialized() const { return initialized_; } 403 bool MediaGalleriesPreferences::IsInitialized() const { return initialized_; }
407 404
408 Profile* MediaGalleriesPreferences::profile() { return profile_; } 405 Profile* MediaGalleriesPreferences::profile() { return profile_; }
409 406
410 void MediaGalleriesPreferences::OnInitializationCallbackReturned() { 407 void MediaGalleriesPreferences::OnInitializationCallbackReturned() {
411 DCHECK(!IsInitialized()); 408 DCHECK(!IsInitialized());
412 DCHECK(pre_initialization_callbacks_waiting_ > 0); 409 DCHECK(pre_initialization_callbacks_waiting_ > 0);
413 if (--pre_initialization_callbacks_waiting_ == 0) 410 if (--pre_initialization_callbacks_waiting_ == 0)
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 if (extension_prefs_for_testing_) 1071 if (extension_prefs_for_testing_)
1075 return extension_prefs_for_testing_; 1072 return extension_prefs_for_testing_;
1076 return extensions::ExtensionPrefs::Get(profile_); 1073 return extensions::ExtensionPrefs::Get(profile_);
1077 } 1074 }
1078 1075
1079 void MediaGalleriesPreferences::SetExtensionPrefsForTesting( 1076 void MediaGalleriesPreferences::SetExtensionPrefsForTesting(
1080 extensions::ExtensionPrefs* extension_prefs) { 1077 extensions::ExtensionPrefs* extension_prefs) {
1081 DCHECK(IsInitialized()); 1078 DCHECK(IsInitialized());
1082 extension_prefs_for_testing_ = extension_prefs; 1079 extension_prefs_for_testing_ = extension_prefs;
1083 } 1080 }
OLDNEW
« no previous file with comments | « chrome/browser/media_galleries/fileapi/picasa_finder.cc ('k') | chrome/browser/media_galleries/media_galleries_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698