Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_permission_controller.h " | 5 #include "chrome/browser/media_galleries/media_galleries_permission_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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 iter != new_galleries_.end(); ++iter) { | 314 iter != new_galleries_.end(); ++iter) { |
| 315 if (iter->second.pref_info.path == gallery.path && | 315 if (iter->second.pref_info.path == gallery.path && |
| 316 iter->second.pref_info.device_id == gallery.device_id) { | 316 iter->second.pref_info.device_id == gallery.device_id) { |
| 317 iter->second.selected = true; | 317 iter->second.selected = true; |
| 318 dialog_->UpdateGalleries(); | 318 dialog_->UpdateGalleries(); |
| 319 return; | 319 return; |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 | 322 |
| 323 // Lastly, if not found, add a new gallery to |new_galleries_|. | 323 // Lastly, if not found, add a new gallery to |new_galleries_|. |
| 324 DCHECK_EQ(kInvalidMediaGalleryPrefId, gallery.pref_id); | 324 // prefId == kInvalidMediaGalleryPrefId for completely new galleries. |
| 325 gallery.pref_id = GetDialogId(kInvalidMediaGalleryPrefId); | 325 // The old prefId is retained for blacklisted galleries. |
| 326 gallery.pref_id = GetDialogId(gallery.pref_id); | |
|
vandebo (ex-Chrome)
2014/06/10 21:57:17
I think this fixes a bug I just introduced... Can
tommycli
2014/06/10 23:59:06
Done.
| |
| 326 new_galleries_[gallery.pref_id] = Entry(gallery, true); | 327 new_galleries_[gallery.pref_id] = Entry(gallery, true); |
| 327 dialog_->UpdateGalleries(); | 328 dialog_->UpdateGalleries(); |
| 328 } | 329 } |
| 329 | 330 |
| 330 void MediaGalleriesPermissionController::OnRemovableStorageAttached( | 331 void MediaGalleriesPermissionController::OnRemovableStorageAttached( |
| 331 const StorageInfo& info) { | 332 const StorageInfo& info) { |
| 332 UpdateGalleriesOnDeviceEvent(info.device_id()); | 333 UpdateGalleriesOnDeviceEvent(info.device_id()); |
| 333 } | 334 } |
| 334 | 335 |
| 335 void MediaGalleriesPermissionController::OnRemovableStorageDetached( | 336 void MediaGalleriesPermissionController::OnRemovableStorageDetached( |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 538 MediaGalleryPrefId | 539 MediaGalleryPrefId |
| 539 MediaGalleriesPermissionController::DialogIdMap::GetPrefId( | 540 MediaGalleriesPermissionController::DialogIdMap::GetPrefId( |
| 540 GalleryDialogId id) { | 541 GalleryDialogId id) { |
| 541 DCHECK_LT(id, next_dialog_id_); | 542 DCHECK_LT(id, next_dialog_id_); |
| 542 return forward_mapping_[id]; | 543 return forward_mapping_[id]; |
| 543 } | 544 } |
| 544 | 545 |
| 545 // MediaGalleries dialog ------------------------------------------------------- | 546 // MediaGalleries dialog ------------------------------------------------------- |
| 546 | 547 |
| 547 MediaGalleriesDialog::~MediaGalleriesDialog() {} | 548 MediaGalleriesDialog::~MediaGalleriesDialog() {} |
| OLD | NEW |