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

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

Powered by Google App Engine
This is Rietveld 408576698