Chromium Code Reviews| 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 #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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 | 92 |
| 93 } // namespace | 93 } // namespace |
| 94 | 94 |
| 95 MediaGalleriesDialogController::MediaGalleriesDialogController( | 95 MediaGalleriesDialogController::MediaGalleriesDialogController( |
| 96 content::WebContents* web_contents, | 96 content::WebContents* web_contents, |
| 97 const Extension& extension, | 97 const Extension& extension, |
| 98 const base::Closure& on_finish) | 98 const base::Closure& on_finish) |
| 99 : web_contents_(web_contents), | 99 : web_contents_(web_contents), |
| 100 extension_(&extension), | 100 extension_(&extension), |
| 101 on_finish_(on_finish) { | 101 on_finish_(on_finish) { |
| 102 // Note: Passing unretained pointer is safe, since the dialog controller | |
|
vandebo (ex-Chrome)
2013/05/31 18:05:03
nit: Remove "Note:" a comment is already a Note. T
Greg Billock
2013/06/01 01:48:46
Done.
| |
| 103 // won't be deleted until it can be shown and then closed. | |
| 104 StorageMonitor::GetInstance()->Initialize(base::Bind( | |
| 105 &MediaGalleriesDialogController::OnStorageMonitorInitialized, | |
| 106 base::Unretained(this))); | |
| 107 } | |
| 108 | |
| 109 void MediaGalleriesDialogController::OnStorageMonitorInitialized() { | |
| 102 MediaFileSystemRegistry* registry = | 110 MediaFileSystemRegistry* registry = |
| 103 g_browser_process->media_file_system_registry(); | 111 g_browser_process->media_file_system_registry(); |
| 104 preferences_ = registry->GetPreferences( | 112 preferences_ = registry->GetPreferences( |
| 105 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 113 Profile::FromBrowserContext(web_contents_->GetBrowserContext())); |
| 106 InitializePermissions(); | 114 InitializePermissions(); |
| 107 | 115 |
| 108 dialog_.reset(MediaGalleriesDialog::Create(this)); | 116 dialog_.reset(MediaGalleriesDialog::Create(this)); |
| 109 | 117 |
| 110 StorageMonitor* monitor = StorageMonitor::GetInstance(); | 118 StorageMonitor* monitor = StorageMonitor::GetInstance(); |
| 111 if (monitor) | 119 if (monitor) |
| 112 monitor->AddObserver(this); | 120 monitor->AddObserver(this); |
| 113 | 121 |
| 114 preferences_->AddGalleryChangeObserver(this); | 122 preferences_->AddGalleryChangeObserver(this); |
| 115 } | 123 } |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 507 if (iter->pref_info.device_id == device_id) | 515 if (iter->pref_info.device_id == device_id) |
| 508 dialog_->UpdateGallery(iter->pref_info, iter->allowed); | 516 dialog_->UpdateGallery(iter->pref_info, iter->allowed); |
| 509 } | 517 } |
| 510 } | 518 } |
| 511 | 519 |
| 512 // MediaGalleries dialog ------------------------------------------------------- | 520 // MediaGalleries dialog ------------------------------------------------------- |
| 513 | 521 |
| 514 MediaGalleriesDialog::~MediaGalleriesDialog() {} | 522 MediaGalleriesDialog::~MediaGalleriesDialog() {} |
| 515 | 523 |
| 516 } // namespace chrome | 524 } // namespace chrome |
| OLD | NEW |