| 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 // Implements the Chrome Extensions Media Galleries API. | 5 // Implements the Chrome Extensions Media Galleries API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/media_galleries/media_galleries_api.h" | 7 #include "chrome/browser/extensions/api/media_galleries/media_galleries_api.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_ADD_GALLERY_TITLE), | 267 l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_ADD_GALLERY_TITLE), |
| 268 default_path, | 268 default_path, |
| 269 NULL, | 269 NULL, |
| 270 0, | 270 0, |
| 271 base::FilePath::StringType(), | 271 base::FilePath::StringType(), |
| 272 platform_util::GetTopLevel(web_contents_->GetNativeView()), | 272 platform_util::GetTopLevel(web_contents_->GetNativeView()), |
| 273 NULL); | 273 NULL); |
| 274 } | 274 } |
| 275 | 275 |
| 276 // ui::SelectFileDialog::Listener implementation. | 276 // ui::SelectFileDialog::Listener implementation. |
| 277 virtual void FileSelected(const base::FilePath& path, | 277 void FileSelected(const base::FilePath& path, |
| 278 int index, | 278 int index, |
| 279 void* params) override { | 279 void* params) override { |
| 280 callback_.Run(path); | 280 callback_.Run(path); |
| 281 Release(); // Balanced in Show(). | 281 Release(); // Balanced in Show(). |
| 282 } | 282 } |
| 283 | 283 |
| 284 virtual void MultiFilesSelected(const std::vector<base::FilePath>& files, | 284 void MultiFilesSelected(const std::vector<base::FilePath>& files, |
| 285 void* params) override { | 285 void* params) override { |
| 286 NOTREACHED() << "Should not be able to select multiple files"; | 286 NOTREACHED() << "Should not be able to select multiple files"; |
| 287 } | 287 } |
| 288 | 288 |
| 289 virtual void FileSelectionCanceled(void* params) override { | 289 void FileSelectionCanceled(void* params) override { |
| 290 callback_.Run(base::FilePath()); | 290 callback_.Run(base::FilePath()); |
| 291 Release(); // Balanced in Show(). | 291 Release(); // Balanced in Show(). |
| 292 } | 292 } |
| 293 | 293 |
| 294 private: | 294 private: |
| 295 friend class base::RefCounted<SelectDirectoryDialog>; | 295 friend class base::RefCounted<SelectDirectoryDialog>; |
| 296 virtual ~SelectDirectoryDialog() {} | 296 ~SelectDirectoryDialog() override {} |
| 297 | 297 |
| 298 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 298 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
| 299 WebContents* web_contents_; | 299 WebContents* web_contents_; |
| 300 Callback callback_; | 300 Callback callback_; |
| 301 | 301 |
| 302 DISALLOW_COPY_AND_ASSIGN(SelectDirectoryDialog); | 302 DISALLOW_COPY_AND_ASSIGN(SelectDirectoryDialog); |
| 303 }; | 303 }; |
| 304 | 304 |
| 305 } // namespace | 305 } // namespace |
| 306 | 306 |
| (...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 &MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit, this)); | 1269 &MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit, this)); |
| 1270 return true; | 1270 return true; |
| 1271 } | 1271 } |
| 1272 | 1272 |
| 1273 void MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit() { | 1273 void MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit() { |
| 1274 gallery_watch_manager()->RemoveAllWatches(GetProfile(), extension_id()); | 1274 gallery_watch_manager()->RemoveAllWatches(GetProfile(), extension_id()); |
| 1275 SendResponse(true); | 1275 SendResponse(true); |
| 1276 } | 1276 } |
| 1277 | 1277 |
| 1278 } // namespace extensions | 1278 } // namespace extensions |
| OLD | NEW |