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 StorageMonitor::GetInstance()->Initialize(base::Bind( | |
|
vandebo (ex-Chrome)
2013/05/23 15:04:17
nit: add a comment about why unretained is safe.
Greg Billock
2013/05/30 22:17:47
Done.
| |
| 103 &MediaGalleriesDialogController::OnStorageMonitorInitialized, | |
| 104 base::Unretained(this))); | |
| 105 } | |
| 106 | |
| 107 void MediaGalleriesDialogController::OnStorageMonitorInitialized() { | |
| 102 MediaFileSystemRegistry* registry = | 108 MediaFileSystemRegistry* registry = |
| 103 g_browser_process->media_file_system_registry(); | 109 g_browser_process->media_file_system_registry(); |
| 104 preferences_ = registry->GetPreferences( | 110 preferences_ = registry->GetPreferences( |
| 105 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 111 Profile::FromBrowserContext(web_contents_->GetBrowserContext())); |
| 106 InitializePermissions(); | 112 InitializePermissions(); |
| 107 | 113 |
| 108 dialog_.reset(MediaGalleriesDialog::Create(this)); | 114 dialog_.reset(MediaGalleriesDialog::Create(this)); |
| 109 | 115 |
| 110 StorageMonitor* monitor = StorageMonitor::GetInstance(); | 116 StorageMonitor* monitor = StorageMonitor::GetInstance(); |
| 111 if (monitor) | 117 if (monitor) |
|
vandebo (ex-Chrome)
2013/05/23 15:04:17
aside: looks like you can remove this if(monitor)
Greg Billock
2013/05/30 22:17:47
Done in separate cl along with many others.
| |
| 112 monitor->AddObserver(this); | 118 monitor->AddObserver(this); |
| 113 | 119 |
| 114 preferences_->AddGalleryChangeObserver(this); | 120 preferences_->AddGalleryChangeObserver(this); |
| 115 } | 121 } |
| 116 | 122 |
| 117 MediaGalleriesDialogController::MediaGalleriesDialogController() | 123 MediaGalleriesDialogController::MediaGalleriesDialogController() |
| 118 : web_contents_(NULL), | 124 : web_contents_(NULL), |
| 119 extension_(NULL), | 125 extension_(NULL), |
| 120 preferences_(NULL) {} | 126 preferences_(NULL) {} |
| 121 | 127 |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 507 if (iter->pref_info.device_id == device_id) | 513 if (iter->pref_info.device_id == device_id) |
| 508 dialog_->UpdateGallery(iter->pref_info, iter->allowed); | 514 dialog_->UpdateGallery(iter->pref_info, iter->allowed); |
| 509 } | 515 } |
| 510 } | 516 } |
| 511 | 517 |
| 512 // MediaGalleries dialog ------------------------------------------------------- | 518 // MediaGalleries dialog ------------------------------------------------------- |
| 513 | 519 |
| 514 MediaGalleriesDialog::~MediaGalleriesDialog() {} | 520 MediaGalleriesDialog::~MediaGalleriesDialog() {} |
| 515 | 521 |
| 516 } // namespace chrome | 522 } // namespace chrome |
| OLD | NEW |