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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 for (GalleryPermissionsMap::const_iterator iter = new_galleries_.begin(); | 153 for (GalleryPermissionsMap::const_iterator iter = new_galleries_.begin(); |
154 iter != new_galleries_.end(); | 154 iter != new_galleries_.end(); |
155 ++iter) { | 155 ++iter) { |
156 if (iter->second.selected) | 156 if (iter->second.selected) |
157 return true; | 157 return true; |
158 } | 158 } |
159 | 159 |
160 return false; | 160 return false; |
161 } | 161 } |
162 | 162 |
163 bool MediaGalleriesPermissionController::ShouldShowFolderViewer( | |
164 const Entry& entry) const { | |
165 return false; | |
166 } | |
167 | |
168 std::vector<base::string16> | 163 std::vector<base::string16> |
169 MediaGalleriesPermissionController::GetSectionHeaders() const { | 164 MediaGalleriesPermissionController::GetSectionHeaders() const { |
170 std::vector<base::string16> result; | 165 std::vector<base::string16> result; |
171 result.push_back(base::string16()); // First section has no header. | 166 result.push_back(base::string16()); // First section has no header. |
172 result.push_back( | 167 result.push_back( |
173 l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_PERMISSION_SUGGESTIONS)); | 168 l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_PERMISSION_SUGGESTIONS)); |
174 return result; | 169 return result; |
175 } | 170 } |
176 | 171 |
177 // Note: sorts by display criterion: GalleriesVectorComparator. | 172 // Note: sorts by display criterion: GalleriesVectorComparator. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 235 |
241 iter = new_galleries_.find(gallery_id); | 236 iter = new_galleries_.find(gallery_id); |
242 if (iter != new_galleries_.end()) | 237 if (iter != new_galleries_.end()) |
243 iter->second.selected = selected; | 238 iter->second.selected = selected; |
244 | 239 |
245 // Don't sort -- the dialog is open, and we don't want to adjust any | 240 // Don't sort -- the dialog is open, and we don't want to adjust any |
246 // positions for future updates to the dialog contents until they are | 241 // positions for future updates to the dialog contents until they are |
247 // redrawn. | 242 // redrawn. |
248 } | 243 } |
249 | 244 |
250 void MediaGalleriesPermissionController::DidClickOpenFolderViewer( | |
251 GalleryDialogId gallery_id) { | |
252 NOTREACHED(); | |
253 } | |
254 | |
255 void MediaGalleriesPermissionController::DidForgetEntry( | 245 void MediaGalleriesPermissionController::DidForgetEntry( |
256 GalleryDialogId gallery_id) { | 246 GalleryDialogId gallery_id) { |
257 media_galleries::UsageCount(media_galleries::DIALOG_FORGET_GALLERY); | 247 media_galleries::UsageCount(media_galleries::DIALOG_FORGET_GALLERY); |
258 if (!new_galleries_.erase(gallery_id)) { | 248 if (!new_galleries_.erase(gallery_id)) { |
259 DCHECK(ContainsKey(known_galleries_, gallery_id)); | 249 DCHECK(ContainsKey(known_galleries_, gallery_id)); |
260 forgotten_galleries_.insert(gallery_id); | 250 forgotten_galleries_.insert(gallery_id); |
261 } | 251 } |
262 dialog_->UpdateGalleries(); | 252 dialog_->UpdateGalleries(); |
263 } | 253 } |
264 | 254 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 MediaGalleryPrefId | 539 MediaGalleryPrefId |
550 MediaGalleriesPermissionController::DialogIdMap::GetPrefId( | 540 MediaGalleriesPermissionController::DialogIdMap::GetPrefId( |
551 GalleryDialogId id) const { | 541 GalleryDialogId id) const { |
552 DCHECK_LT(id, next_dialog_id_); | 542 DCHECK_LT(id, next_dialog_id_); |
553 return forward_mapping_[id]; | 543 return forward_mapping_[id]; |
554 } | 544 } |
555 | 545 |
556 // MediaGalleries dialog ------------------------------------------------------- | 546 // MediaGalleries dialog ------------------------------------------------------- |
557 | 547 |
558 MediaGalleriesDialog::~MediaGalleriesDialog() {} | 548 MediaGalleriesDialog::~MediaGalleriesDialog() {} |
OLD | NEW |