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

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: 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 <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 MediaGalleriesGetMediaFileSystemsFunction:: 66 MediaGalleriesGetMediaFileSystemsFunction::
67 ~MediaGalleriesGetMediaFileSystemsFunction() {} 67 ~MediaGalleriesGetMediaFileSystemsFunction() {}
68 68
69 bool MediaGalleriesGetMediaFileSystemsFunction::RunImpl() { 69 bool MediaGalleriesGetMediaFileSystemsFunction::RunImpl() {
70 if (!ApiIsAccessible(&error_)) 70 if (!ApiIsAccessible(&error_))
71 return false; 71 return false;
72 72
73 scoped_ptr<GetMediaFileSystems::Params> params( 73 scoped_ptr<GetMediaFileSystems::Params> params(
74 GetMediaFileSystems::Params::Create(*args_)); 74 GetMediaFileSystems::Params::Create(*args_));
75 EXTENSION_FUNCTION_VALIDATE(params.get()); 75 EXTENSION_FUNCTION_VALIDATE(params.get());
76 MediaGalleries::GetMediaFileSystemsInteractivity interactive = "no"; 76 MediaGalleries::GetMediaFileSystemsInteractivity interactive =
77 if (params->details.get() && params->details->interactive.get()) 77 MediaGalleries::MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NO;
78 interactive = *params->details->interactive; 78 if (params->details.get() && params->details->interactive != MediaGalleries::
79 79 MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NONE) {
80 if (interactive == "yes") { 80 interactive = params->details->interactive;
81 ShowDialog();
82 return true;
83 } else if (interactive == "if_needed") {
84 MediaFileSystemRegistry::GetInstance()->GetMediaFileSystemsForExtension(
85 render_view_host(), GetExtension(), base::Bind(
86 &MediaGalleriesGetMediaFileSystemsFunction::ShowDialogIfNoGalleries,
87 this));
88 return true;
89 } else if (interactive == "no") {
90 GetAndReturnGalleries();
91 return true;
92 } 81 }
93 82
83 switch (interactive) {
84 case MediaGalleries::
85 MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_YES:
86 ShowDialog();
87 return true;
88 case MediaGalleries::
89 MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_IF_NEEDED:
90 MediaFileSystemRegistry::GetInstance()->GetMediaFileSystemsForExtension(
91 render_view_host(), GetExtension(), base::Bind(
92 &MediaGalleriesGetMediaFileSystemsFunction::
93 ShowDialogIfNoGalleries,
94 this));
95 return true;
96 case MediaGalleries::
97 MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NO:
98 GetAndReturnGalleries();
99 return true;
100 case MediaGalleries::
101 MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NONE:
102 NOTREACHED();
103 }
94 error_ = kInvalidInteractive; 104 error_ = kInvalidInteractive;
95 return false; 105 return false;
96 } 106 }
97 107
98 void MediaGalleriesGetMediaFileSystemsFunction::ShowDialogIfNoGalleries( 108 void MediaGalleriesGetMediaFileSystemsFunction::ShowDialogIfNoGalleries(
99 const std::vector<MediaFileSystemInfo>& filesystems) { 109 const std::vector<MediaFileSystemInfo>& filesystems) {
100 if (filesystems.empty()) 110 if (filesystems.empty())
101 ShowDialog(); 111 ShowDialog();
102 else 112 else
103 ReturnGalleries(filesystems); 113 ReturnGalleries(filesystems);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() { 189 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() {
180 if (!ApiIsAccessible(&error_)) 190 if (!ApiIsAccessible(&error_))
181 return false; 191 return false;
182 192
183 // TODO(vandebo) Update the metadata and return the new file. 193 // TODO(vandebo) Update the metadata and return the new file.
184 SetResult(Value::CreateNullValue()); 194 SetResult(Value::CreateNullValue());
185 return true; 195 return true;
186 } 196 }
187 197
188 } // namespace extensions 198 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698