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

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

Issue 14556015: [Media Galleries] Lazily initialize the storage monitor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Windows compile tweaks Created 7 years, 7 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
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_dialog_controller.h" 5 #include "chrome/browser/media_galleries/media_galleries_dialog_controller.h"
6 6
7 #include "base/i18n/time_formatting.h" 7 #include "base/i18n/time_formatting.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 MediaGalleriesDialogController::MediaGalleriesDialogController( 58 MediaGalleriesDialogController::MediaGalleriesDialogController(
59 content::WebContents* web_contents, 59 content::WebContents* web_contents,
60 const Extension& extension, 60 const Extension& extension,
61 const base::Closure& on_finish) 61 const base::Closure& on_finish)
62 : web_contents_(web_contents), 62 : web_contents_(web_contents),
63 extension_(&extension), 63 extension_(&extension),
64 on_finish_(on_finish) { 64 on_finish_(on_finish) {
65 MediaFileSystemRegistry* registry = 65 MediaFileSystemRegistry* registry =
66 g_browser_process->media_file_system_registry(); 66 g_browser_process->media_file_system_registry();
67 preferences_ = registry->GetPreferences( 67 registry->GetPreferencesAsync(
68 Profile::FromBrowserContext(web_contents->GetBrowserContext())); 68 Profile::FromBrowserContext(web_contents->GetBrowserContext()),
69 base::Bind(&MediaGalleriesDialogController::Init,
70 base::Unretained(this)));
71 }
72
73 void MediaGalleriesDialogController::Init(
74 MediaGalleriesPreferences* preferences) {
75 preferences_ = preferences;
69 InitializePermissions(); 76 InitializePermissions();
70 77
71 dialog_.reset(MediaGalleriesDialog::Create(this)); 78 dialog_.reset(MediaGalleriesDialog::Create(this));
72 79
73 StorageMonitor* monitor = StorageMonitor::GetInstance(); 80 StorageMonitor* monitor = StorageMonitor::GetInstance();
74 if (monitor) 81 if (monitor)
75 monitor->AddObserver(this); 82 monitor->AddObserver(this);
76 83
77 preferences_->AddGalleryChangeObserver(this); 84 preferences_->AddGalleryChangeObserver(this);
78 } 85 }
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 if (iter->pref_info.device_id == device_id) 459 if (iter->pref_info.device_id == device_id)
453 dialog_->UpdateGallery(iter->pref_info, iter->allowed); 460 dialog_->UpdateGallery(iter->pref_info, iter->allowed);
454 } 461 }
455 } 462 }
456 463
457 // MediaGalleries dialog ------------------------------------------------------- 464 // MediaGalleries dialog -------------------------------------------------------
458 465
459 MediaGalleriesDialog::~MediaGalleriesDialog() {} 466 MediaGalleriesDialog::~MediaGalleriesDialog() {}
460 467
461 } // namespace chrome 468 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698