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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // TODO(gbillock): This is a placeholder. Need to actually get the | 140 // TODO(gbillock): This is a placeholder. Need to actually get the |
141 // right text here. | 141 // right text here. |
142 return attached; | 142 return attached; |
143 } | 143 } |
144 | 144 |
145 string16 MediaGalleriesDialogController::GetHeader() const { | 145 string16 MediaGalleriesDialogController::GetHeader() const { |
146 return l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_HEADER); | 146 return l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_HEADER); |
147 } | 147 } |
148 | 148 |
149 string16 MediaGalleriesDialogController::GetSubtext() const { | 149 string16 MediaGalleriesDialogController::GetSubtext() const { |
150 std::string extension_name(extension_ ? extension_->name() : ""); | 150 std::string extension_name(extension_ ? extension_->name() : std::string()); |
151 return l10n_util::GetStringFUTF16(IDS_MEDIA_GALLERIES_DIALOG_SUBTEXT, | 151 return l10n_util::GetStringFUTF16(IDS_MEDIA_GALLERIES_DIALOG_SUBTEXT, |
152 UTF8ToUTF16(extension_name)); | 152 UTF8ToUTF16(extension_name)); |
153 } | 153 } |
154 | 154 |
155 string16 MediaGalleriesDialogController::GetUnattachedLocationsHeader() const { | 155 string16 MediaGalleriesDialogController::GetUnattachedLocationsHeader() const { |
156 return l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_UNATTACHED_LOCATIONS); | 156 return l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_UNATTACHED_LOCATIONS); |
157 } | 157 } |
158 | 158 |
159 bool MediaGalleriesDialogController::HasPermittedGalleries() const { | 159 bool MediaGalleriesDialogController::HasPermittedGalleries() const { |
160 for (KnownGalleryPermissions::const_iterator iter = permissions().begin(); | 160 for (KnownGalleryPermissions::const_iterator iter = permissions().begin(); |
(...skipping 16 matching lines...) Expand all Loading... |
177 | 177 |
178 void MediaGalleriesDialogController::OnAddFolderClicked() { | 178 void MediaGalleriesDialogController::OnAddFolderClicked() { |
179 base::FilePath user_data_dir; | 179 base::FilePath user_data_dir; |
180 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 180 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
181 select_folder_dialog_ = | 181 select_folder_dialog_ = |
182 ui::SelectFileDialog::Create(this, new ChromeSelectFilePolicy(NULL)); | 182 ui::SelectFileDialog::Create(this, new ChromeSelectFilePolicy(NULL)); |
183 select_folder_dialog_->SelectFile( | 183 select_folder_dialog_->SelectFile( |
184 ui::SelectFileDialog::SELECT_FOLDER, | 184 ui::SelectFileDialog::SELECT_FOLDER, |
185 l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_ADD_GALLERY_TITLE), | 185 l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_ADD_GALLERY_TITLE), |
186 user_data_dir, | 186 user_data_dir, |
187 NULL, 0, FILE_PATH_LITERAL(""), | 187 NULL, |
| 188 0, |
| 189 base::FilePath::StringType(), |
188 web_contents_->GetView()->GetTopLevelNativeWindow(), | 190 web_contents_->GetView()->GetTopLevelNativeWindow(), |
189 NULL); | 191 NULL); |
190 } | 192 } |
191 | 193 |
192 void MediaGalleriesDialogController::DidToggleGallery( | 194 void MediaGalleriesDialogController::DidToggleGallery( |
193 const MediaGalleryPrefInfo* gallery, | 195 const MediaGalleryPrefInfo* gallery, |
194 bool enabled) { | 196 bool enabled) { |
195 // Check known galleries. | 197 // Check known galleries. |
196 KnownGalleryPermissions::iterator iter = | 198 KnownGalleryPermissions::iterator iter = |
197 known_galleries_.find(gallery->pref_id); | 199 known_galleries_.find(gallery->pref_id); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (iter->pref_info.device_id == device_id) | 400 if (iter->pref_info.device_id == device_id) |
399 dialog_->UpdateGallery(&iter->pref_info, iter->allowed); | 401 dialog_->UpdateGallery(&iter->pref_info, iter->allowed); |
400 } | 402 } |
401 } | 403 } |
402 | 404 |
403 // MediaGalleries dialog ------------------------------------------------------- | 405 // MediaGalleries dialog ------------------------------------------------------- |
404 | 406 |
405 MediaGalleriesDialog::~MediaGalleriesDialog() {} | 407 MediaGalleriesDialog::~MediaGalleriesDialog() {} |
406 | 408 |
407 } // namespace chrome | 409 } // namespace chrome |
OLD | NEW |