Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: chrome/browser/extensions/api/media_galleries/media_galleries_api.cc

Issue 2688413007: Add display::GetDisplayNearestView (Closed)
Patch Set: add missing files Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 16 matching lines...) Expand all
27 #include "chrome/browser/extensions/api/file_system/file_system_api.h" 27 #include "chrome/browser/extensions/api/file_system/file_system_api.h"
28 #include "chrome/browser/extensions/blob_reader.h" 28 #include "chrome/browser/extensions/blob_reader.h"
29 #include "chrome/browser/extensions/chrome_extension_function_details.h" 29 #include "chrome/browser/extensions/chrome_extension_function_details.h"
30 #include "chrome/browser/extensions/extension_tab_util.h" 30 #include "chrome/browser/extensions/extension_tab_util.h"
31 #include "chrome/browser/media_galleries/fileapi/safe_media_metadata_parser.h" 31 #include "chrome/browser/media_galleries/fileapi/safe_media_metadata_parser.h"
32 #include "chrome/browser/media_galleries/gallery_watch_manager.h" 32 #include "chrome/browser/media_galleries/gallery_watch_manager.h"
33 #include "chrome/browser/media_galleries/media_file_system_registry.h" 33 #include "chrome/browser/media_galleries/media_file_system_registry.h"
34 #include "chrome/browser/media_galleries/media_galleries_histograms.h" 34 #include "chrome/browser/media_galleries/media_galleries_histograms.h"
35 #include "chrome/browser/media_galleries/media_galleries_permission_controller.h " 35 #include "chrome/browser/media_galleries/media_galleries_permission_controller.h "
36 #include "chrome/browser/media_galleries/media_galleries_preferences.h" 36 #include "chrome/browser/media_galleries/media_galleries_preferences.h"
37 #include "chrome/browser/platform_util.h"
38 #include "chrome/browser/profiles/profile.h" 37 #include "chrome/browser/profiles/profile.h"
39 #include "chrome/browser/ui/chrome_select_file_policy.h" 38 #include "chrome/browser/ui/chrome_select_file_policy.h"
40 #include "chrome/common/extensions/api/media_galleries.h" 39 #include "chrome/common/extensions/api/media_galleries.h"
41 #include "chrome/common/pref_names.h" 40 #include "chrome/common/pref_names.h"
42 #include "chrome/grit/generated_resources.h" 41 #include "chrome/grit/generated_resources.h"
43 #include "components/storage_monitor/storage_info.h" 42 #include "components/storage_monitor/storage_info.h"
44 #include "components/web_modal/web_contents_modal_dialog_manager.h" 43 #include "components/web_modal/web_contents_modal_dialog_manager.h"
45 #include "content/public/browser/blob_handle.h" 44 #include "content/public/browser/blob_handle.h"
46 #include "content/public/browser/browser_context.h" 45 #include "content/public/browser/browser_context.h"
47 #include "content/public/browser/browser_thread.h" 46 #include "content/public/browser/browser_thread.h"
48 #include "content/public/browser/child_process_security_policy.h" 47 #include "content/public/browser/child_process_security_policy.h"
49 #include "content/public/browser/render_frame_host.h" 48 #include "content/public/browser/render_frame_host.h"
50 #include "content/public/browser/render_process_host.h" 49 #include "content/public/browser/render_process_host.h"
51 #include "content/public/browser/render_view_host.h" 50 #include "content/public/browser/render_view_host.h"
52 #include "content/public/browser/web_contents.h" 51 #include "content/public/browser/web_contents.h"
53 #include "extensions/browser/app_window/app_window.h" 52 #include "extensions/browser/app_window/app_window.h"
54 #include "extensions/browser/app_window/app_window_registry.h" 53 #include "extensions/browser/app_window/app_window_registry.h"
55 #include "extensions/browser/blob_holder.h" 54 #include "extensions/browser/blob_holder.h"
56 #include "extensions/browser/extension_prefs.h" 55 #include "extensions/browser/extension_prefs.h"
57 #include "extensions/browser/extension_system.h" 56 #include "extensions/browser/extension_system.h"
58 #include "extensions/common/extension.h" 57 #include "extensions/common/extension.h"
59 #include "extensions/common/permissions/api_permission.h" 58 #include "extensions/common/permissions/api_permission.h"
60 #include "extensions/common/permissions/media_galleries_permission.h" 59 #include "extensions/common/permissions/media_galleries_permission.h"
61 #include "extensions/common/permissions/permissions_data.h" 60 #include "extensions/common/permissions/permissions_data.h"
62 #include "net/base/mime_sniffer.h" 61 #include "net/base/mime_sniffer.h"
63 #include "storage/browser/blob/blob_data_handle.h" 62 #include "storage/browser/blob/blob_data_handle.h"
64 #include "ui/base/l10n/l10n_util.h" 63 #include "ui/base/l10n/l10n_util.h"
64 #include "ui/gfx/view_util.h"
65 65
66 using content::WebContents; 66 using content::WebContents;
67 using storage_monitor::MediaStorageUtil; 67 using storage_monitor::MediaStorageUtil;
68 using storage_monitor::StorageInfo; 68 using storage_monitor::StorageInfo;
69 69
70 namespace extensions { 70 namespace extensions {
71 71
72 namespace MediaGalleries = api::media_galleries; 72 namespace MediaGalleries = api::media_galleries;
73 namespace GetMediaFileSystems = MediaGalleries::GetMediaFileSystems; 73 namespace GetMediaFileSystems = MediaGalleries::GetMediaFileSystems;
74 namespace AddGalleryWatch = MediaGalleries::AddGalleryWatch; 74 namespace AddGalleryWatch = MediaGalleries::AddGalleryWatch;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 SelectDirectoryDialog(WebContents* web_contents, const Callback& callback) 219 SelectDirectoryDialog(WebContents* web_contents, const Callback& callback)
220 : web_contents_(web_contents), 220 : web_contents_(web_contents),
221 callback_(callback) { 221 callback_(callback) {
222 select_file_dialog_ = ui::SelectFileDialog::Create( 222 select_file_dialog_ = ui::SelectFileDialog::Create(
223 this, new ChromeSelectFilePolicy(web_contents)); 223 this, new ChromeSelectFilePolicy(web_contents));
224 } 224 }
225 225
226 void Show(const base::FilePath& default_path) { 226 void Show(const base::FilePath& default_path) {
227 AddRef(); // Balanced in the two reachable listener outcomes. 227 AddRef(); // Balanced in the two reachable listener outcomes.
228 select_file_dialog_->SelectFile( 228 select_file_dialog_->SelectFile(
229 ui::SelectFileDialog::SELECT_FOLDER, 229 ui::SelectFileDialog::SELECT_FOLDER,
230 l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_ADD_GALLERY_TITLE), 230 l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_ADD_GALLERY_TITLE),
231 default_path, 231 default_path, NULL, 0, base::FilePath::StringType(),
232 NULL, 232 gfx::GetTopLevel(web_contents_->GetNativeView()), NULL);
233 0,
234 base::FilePath::StringType(),
235 platform_util::GetTopLevel(web_contents_->GetNativeView()),
236 NULL);
237 } 233 }
238 234
239 // ui::SelectFileDialog::Listener implementation. 235 // ui::SelectFileDialog::Listener implementation.
240 void FileSelected(const base::FilePath& path, 236 void FileSelected(const base::FilePath& path,
241 int index, 237 int index,
242 void* params) override { 238 void* params) override {
243 callback_.Run(path); 239 callback_.Run(path);
244 Release(); // Balanced in Show(). 240 Release(); // Balanced in Show().
245 } 241 }
246 242
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 SendResponse(false); 904 SendResponse(false);
909 return; 905 return;
910 } 906 }
911 907
912 gallery_watch_manager()->RemoveWatch( 908 gallery_watch_manager()->RemoveWatch(
913 GetProfile(), extension_id(), gallery_pref_id); 909 GetProfile(), extension_id(), gallery_pref_id);
914 SendResponse(true); 910 SendResponse(true);
915 } 911 }
916 912
917 } // namespace extensions 913 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698