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

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

Issue 23727009: Cleanup: Remove chrome namespace for storage monitor and media galleries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 7 years, 3 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 | Annotate | Revision Log
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 <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 21 matching lines...) Expand all
32 #include "content/public/browser/child_process_security_policy.h" 32 #include "content/public/browser/child_process_security_policy.h"
33 #include "content/public/browser/render_process_host.h" 33 #include "content/public/browser/render_process_host.h"
34 #include "content/public/browser/render_view_host.h" 34 #include "content/public/browser/render_view_host.h"
35 #include "content/public/browser/web_contents.h" 35 #include "content/public/browser/web_contents.h"
36 36
37 #if defined(OS_WIN) 37 #if defined(OS_WIN)
38 #include "base/strings/sys_string_conversions.h" 38 #include "base/strings/sys_string_conversions.h"
39 #endif 39 #endif
40 40
41 using apps::ShellWindow; 41 using apps::ShellWindow;
42 using chrome::MediaFileSystemInfo;
43 using chrome::MediaFileSystemRegistry;
44 using chrome::MediaFileSystemsCallback;
45 using content::ChildProcessSecurityPolicy; 42 using content::ChildProcessSecurityPolicy;
46 using content::WebContents; 43 using content::WebContents;
47 using web_modal::WebContentsModalDialogManager; 44 using web_modal::WebContentsModalDialogManager;
48 45
49 namespace MediaGalleries = extensions::api::media_galleries; 46 namespace MediaGalleries = extensions::api::media_galleries;
50 namespace GetMediaFileSystems = MediaGalleries::GetMediaFileSystems; 47 namespace GetMediaFileSystems = MediaGalleries::GetMediaFileSystems;
51 48
52 namespace extensions { 49 namespace extensions {
53 50
54 namespace { 51 namespace {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 scoped_ptr<GetMediaFileSystems::Params> params( 83 scoped_ptr<GetMediaFileSystems::Params> params(
87 GetMediaFileSystems::Params::Create(*args_)); 84 GetMediaFileSystems::Params::Create(*args_));
88 EXTENSION_FUNCTION_VALIDATE(params.get()); 85 EXTENSION_FUNCTION_VALIDATE(params.get());
89 MediaGalleries::GetMediaFileSystemsInteractivity interactive = 86 MediaGalleries::GetMediaFileSystemsInteractivity interactive =
90 MediaGalleries::GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NO; 87 MediaGalleries::GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NO;
91 if (params->details.get() && params->details->interactive != MediaGalleries:: 88 if (params->details.get() && params->details->interactive != MediaGalleries::
92 GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NONE) { 89 GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NONE) {
93 interactive = params->details->interactive; 90 interactive = params->details->interactive;
94 } 91 }
95 92
96 chrome::StorageMonitor::GetInstance()->EnsureInitialized(base::Bind( 93 StorageMonitor::GetInstance()->EnsureInitialized(base::Bind(
97 &MediaGalleriesGetMediaFileSystemsFunction::OnStorageMonitorInit, 94 &MediaGalleriesGetMediaFileSystemsFunction::OnStorageMonitorInit,
98 this, 95 this,
99 interactive)); 96 interactive));
100 return true; 97 return true;
101 } 98 }
102 99
103 void MediaGalleriesGetMediaFileSystemsFunction::OnStorageMonitorInit( 100 void MediaGalleriesGetMediaFileSystemsFunction::OnStorageMonitorInit(
104 MediaGalleries::GetMediaFileSystemsInteractivity interactive) { 101 MediaGalleries::GetMediaFileSystemsInteractivity interactive) {
105 switch (interactive) { 102 switch (interactive) {
106 case MediaGalleries::GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_YES: { 103 case MediaGalleries::GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_YES: {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } else { 218 } else {
222 // Abort showing the dialog. TODO(estade) Perhaps return an error instead. 219 // Abort showing the dialog. TODO(estade) Perhaps return an error instead.
223 GetAndReturnGalleries(); 220 GetAndReturnGalleries();
224 return; 221 return;
225 } 222 }
226 } 223 }
227 224
228 // Controller will delete itself. 225 // Controller will delete itself.
229 base::Closure cb = base::Bind( 226 base::Closure cb = base::Bind(
230 &MediaGalleriesGetMediaFileSystemsFunction::GetAndReturnGalleries, this); 227 &MediaGalleriesGetMediaFileSystemsFunction::GetAndReturnGalleries, this);
231 new chrome::MediaGalleriesDialogController(contents, *GetExtension(), cb); 228 new MediaGalleriesDialogController(contents, *GetExtension(), cb);
232 } 229 }
233 230
234 void MediaGalleriesGetMediaFileSystemsFunction::GetMediaFileSystemsForExtension( 231 void MediaGalleriesGetMediaFileSystemsFunction::GetMediaFileSystemsForExtension(
235 const chrome::MediaFileSystemsCallback& cb) { 232 const MediaFileSystemsCallback& cb) {
236 if (!render_view_host()) { 233 if (!render_view_host()) {
237 cb.Run(std::vector<MediaFileSystemInfo>()); 234 cb.Run(std::vector<MediaFileSystemInfo>());
238 return; 235 return;
239 } 236 }
240 237
241 DCHECK(chrome::StorageMonitor::GetInstance()->IsInitialized()); 238 DCHECK(StorageMonitor::GetInstance()->IsInitialized());
242 MediaFileSystemRegistry* registry = 239 MediaFileSystemRegistry* registry =
243 g_browser_process->media_file_system_registry(); 240 g_browser_process->media_file_system_registry();
244 registry->GetMediaFileSystemsForExtension( 241 registry->GetMediaFileSystemsForExtension(
245 render_view_host(), GetExtension(), cb); 242 render_view_host(), GetExtension(), cb);
246 } 243 }
247 244
248 } // namespace extensions 245 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698