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

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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 AddDefaultGalleriesIfFreshProfile(); 374 AddDefaultGalleriesIfFreshProfile();
375 375
376 // This counter must match the number of async methods dispatched below. 376 // This counter must match the number of async methods dispatched below.
377 // It cannot be incremented inline with each callback, as some may return 377 // It cannot be incremented inline with each callback, as some may return
378 // synchronously, decrement the counter to 0, and prematurely trigger 378 // synchronously, decrement the counter to 0, and prematurely trigger
379 // FinishInitialization. 379 // FinishInitialization.
380 pre_initialization_callbacks_waiting_ = 2; 380 pre_initialization_callbacks_waiting_ = 3;
381 381
382 // Ensure StorageMonitor is initialized. 382 // Ensure StorageMonitor is initialized.
383 StorageMonitor::GetInstance()->EnsureInitialized( 383 StorageMonitor::GetInstance()->EnsureInitialized(
384 base::Bind(&MediaGalleriesPreferences::OnInitializationCallbackReturned, 384 base::Bind(&MediaGalleriesPreferences::OnInitializationCallbackReturned,
385 weak_factory_.GetWeakPtr())); 385 weak_factory_.GetWeakPtr()));
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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 if (extension_prefs_for_testing_) 1069 if (extension_prefs_for_testing_)
1073 return extension_prefs_for_testing_; 1070 return extension_prefs_for_testing_;
1074 return extensions::ExtensionPrefs::Get(profile_); 1071 return extensions::ExtensionPrefs::Get(profile_);
1075 } 1072 }
1076 1073
1077 void MediaGalleriesPreferences::SetExtensionPrefsForTesting( 1074 void MediaGalleriesPreferences::SetExtensionPrefsForTesting(
1078 extensions::ExtensionPrefs* extension_prefs) { 1075 extensions::ExtensionPrefs* extension_prefs) {
1079 DCHECK(IsInitialized()); 1076 DCHECK(IsInitialized());
1080 extension_prefs_for_testing_ = extension_prefs; 1077 extension_prefs_for_testing_ = extension_prefs;
1081 } 1078 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698