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/base_paths.h" | 7 #include "base/base_paths.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/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 media_galleries::UsageCount(media_galleries::DIALOG_GALLERY_ADDED); | 427 media_galleries::UsageCount(media_galleries::DIALOG_GALLERY_ADDED); |
428 // If the user added a gallery then unchecked it, forget about it. | 428 // If the user added a gallery then unchecked it, forget about it. |
429 if (!iter->allowed) | 429 if (!iter->allowed) |
430 continue; | 430 continue; |
431 | 431 |
432 // TODO(gbillock): Should be adding volume metadata during FileSelected. | 432 // TODO(gbillock): Should be adding volume metadata during FileSelected. |
433 const MediaGalleryPrefInfo& gallery = iter->pref_info; | 433 const MediaGalleryPrefInfo& gallery = iter->pref_info; |
434 MediaGalleryPrefId id = preferences_->AddGallery( | 434 MediaGalleryPrefId id = preferences_->AddGallery( |
435 gallery.device_id, gallery.path, MediaGalleryPrefInfo::kUserAdded, | 435 gallery.device_id, gallery.path, MediaGalleryPrefInfo::kUserAdded, |
436 gallery.volume_label, gallery.vendor_name, gallery.model_name, | 436 gallery.volume_label, gallery.vendor_name, gallery.model_name, |
437 gallery.total_size_in_bytes, gallery.last_attach_time); | 437 gallery.total_size_in_bytes, gallery.last_attach_time, 0, 0, 0); |
438 preferences_->SetGalleryPermissionForExtension(*extension_, id, true); | 438 preferences_->SetGalleryPermissionForExtension(*extension_, id, true); |
439 } | 439 } |
440 } | 440 } |
441 | 441 |
442 void MediaGalleriesDialogController::UpdateGalleriesOnPreferencesEvent() { | 442 void MediaGalleriesDialogController::UpdateGalleriesOnPreferencesEvent() { |
443 // Merge in the permissions from |preferences_|. Afterwards, | 443 // Merge in the permissions from |preferences_|. Afterwards, |
444 // |known_galleries_| may contain galleries that no longer belong there, | 444 // |known_galleries_| may contain galleries that no longer belong there, |
445 // but the code below will put |known_galleries_| back in a consistent state. | 445 // but the code below will put |known_galleries_| back in a consistent state. |
446 InitializePermissions(); | 446 InitializePermissions(); |
447 | 447 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 return context_menu_model_.get(); | 479 return context_menu_model_.get(); |
480 } | 480 } |
481 | 481 |
482 Profile* MediaGalleriesDialogController::GetProfile() { | 482 Profile* MediaGalleriesDialogController::GetProfile() { |
483 return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 483 return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
484 } | 484 } |
485 | 485 |
486 // MediaGalleries dialog ------------------------------------------------------- | 486 // MediaGalleries dialog ------------------------------------------------------- |
487 | 487 |
488 MediaGalleriesDialog::~MediaGalleriesDialog() {} | 488 MediaGalleriesDialog::~MediaGalleriesDialog() {} |
OLD | NEW |