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

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

Issue 10907151: Extensions Docs Server: Enum values do not show up if enum is a type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ToString and FromString Created 8 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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 MediaGalleriesGetMediaFileSystemsFunction:: 63 MediaGalleriesGetMediaFileSystemsFunction::
64 ~MediaGalleriesGetMediaFileSystemsFunction() {} 64 ~MediaGalleriesGetMediaFileSystemsFunction() {}
65 65
66 bool MediaGalleriesGetMediaFileSystemsFunction::RunImpl() { 66 bool MediaGalleriesGetMediaFileSystemsFunction::RunImpl() {
67 if (!ApiIsAccessible(&error_)) 67 if (!ApiIsAccessible(&error_))
68 return false; 68 return false;
69 69
70 scoped_ptr<GetMediaFileSystems::Params> params( 70 scoped_ptr<GetMediaFileSystems::Params> params(
71 GetMediaFileSystems::Params::Create(*args_)); 71 GetMediaFileSystems::Params::Create(*args_));
72 EXTENSION_FUNCTION_VALIDATE(params.get()); 72 EXTENSION_FUNCTION_VALIDATE(params.get());
73 MediaGalleries::GetMediaFileSystemsInteractivity interactive = "no"; 73 MediaGalleries::GetMediaFileSystemsInteractivity interactive =
74 if (params->details.get() && params->details->interactive.get()) 74 MediaGalleries::MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NO;
75 interactive = *params->details->interactive; 75 if (params->details.get() && params->details->interactive != MediaGalleries::
76 76 MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NONE) {
77 if (interactive == "yes") { 77 interactive = params->details->interactive;
78 ShowDialog();
79 return true;
80 } else if (interactive == "if_needed") {
81 MediaFileSystemRegistry::GetInstance()->GetMediaFileSystemsForExtension(
82 render_view_host(), GetExtension(), base::Bind(
83 &MediaGalleriesGetMediaFileSystemsFunction::ShowDialogIfNoGalleries,
84 this));
85 return true;
86 } else if (interactive == "no") {
87 GetAndReturnGalleries();
88 return true;
89 } 78 }
90 79
80 switch (interactive) {
81 case MediaGalleries::
82 MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_YES:
83 ShowDialog();
84 return true;
85 case MediaGalleries::
86 MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_IF_NEEDED:
87 MediaFileSystemRegistry::GetInstance()->GetMediaFileSystemsForExtension(
88 render_view_host(), GetExtension(), base::Bind(
89 &MediaGalleriesGetMediaFileSystemsFunction::
90 ShowDialogIfNoGalleries,
91 this));
92 return true;
93 case MediaGalleries::
94 MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NO:
95 GetAndReturnGalleries();
96 return true;
97 case MediaGalleries::
98 MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NONE:
99 NOTREACHED();
100 }
91 error_ = kInvalidInteractive; 101 error_ = kInvalidInteractive;
92 return false; 102 return false;
93 } 103 }
94 104
95 void MediaGalleriesGetMediaFileSystemsFunction::ShowDialogIfNoGalleries( 105 void MediaGalleriesGetMediaFileSystemsFunction::ShowDialogIfNoGalleries(
96 const std::vector<MediaFileSystemInfo>& filesystems) { 106 const std::vector<MediaFileSystemInfo>& filesystems) {
97 if (filesystems.empty()) 107 if (filesystems.empty())
98 ShowDialog(); 108 ShowDialog();
99 else 109 else
100 ReturnGalleries(filesystems); 110 ReturnGalleries(filesystems);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() { 174 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() {
165 if (!ApiIsAccessible(&error_)) 175 if (!ApiIsAccessible(&error_))
166 return false; 176 return false;
167 177
168 // TODO(vandebo) Update the metadata and return the new file. 178 // TODO(vandebo) Update the metadata and return the new file.
169 SetResult(Value::CreateNullValue()); 179 SetResult(Value::CreateNullValue());
170 return true; 180 return true;
171 } 181 }
172 182
173 } // namespace extensions 183 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698