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

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

Issue 11633052: Rename platform-independent ConstrainedWindow types to WebContentsModalDialog types (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use gtk_widget_get_toplevel for GetNativeWindow Created 7 years, 11 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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/platform_file.h" 14 #include "base/platform_file.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/extensions/shell_window_registry.h" 18 #include "chrome/browser/extensions/shell_window_registry.h"
19 #include "chrome/browser/media_gallery/media_file_system_registry.h" 19 #include "chrome/browser/media_gallery/media_file_system_registry.h"
20 #include "chrome/browser/media_gallery/media_galleries_dialog_controller.h" 20 #include "chrome/browser/media_gallery/media_galleries_dialog_controller.h"
21 #include "chrome/browser/ui/chrome_select_file_policy.h" 21 #include "chrome/browser/ui/chrome_select_file_policy.h"
22 #include "chrome/browser/ui/constrained_window_tab_helper.h"
23 #include "chrome/browser/ui/extensions/shell_window.h" 22 #include "chrome/browser/ui/extensions/shell_window.h"
23 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
24 #include "chrome/common/extensions/extension.h" 24 #include "chrome/common/extensions/extension.h"
25 #include "chrome/common/extensions/api/experimental_media_galleries.h" 25 #include "chrome/common/extensions/api/experimental_media_galleries.h"
26 #include "chrome/common/extensions/api/media_galleries.h" 26 #include "chrome/common/extensions/api/media_galleries.h"
27 #include "chrome/common/extensions/permissions/api_permission.h" 27 #include "chrome/common/extensions/permissions/api_permission.h"
28 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "content/public/browser/child_process_security_policy.h" 29 #include "content/public/browser/child_process_security_policy.h"
30 #include "content/public/browser/render_process_host.h" 30 #include "content/public/browser/render_process_host.h"
31 #include "content/public/browser/render_view_host.h" 31 #include "content/public/browser/render_view_host.h"
32 #include "content/public/browser/web_contents.h" 32 #include "content/public/browser/web_contents.h"
33 33
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 // TODO(vandebo) Handle write permission. 167 // TODO(vandebo) Handle write permission.
168 } 168 }
169 169
170 SetResult(list); 170 SetResult(list);
171 SendResponse(true); 171 SendResponse(true);
172 } 172 }
173 173
174 void MediaGalleriesGetMediaFileSystemsFunction::ShowDialog() { 174 void MediaGalleriesGetMediaFileSystemsFunction::ShowDialog() {
175 WebContents* contents = WebContents::FromRenderViewHost(render_view_host()); 175 WebContents* contents = WebContents::FromRenderViewHost(render_view_host());
176 ConstrainedWindowTabHelper* constrained_window_tab_helper = 176 WebContentsModalDialogManager* web_contents_dialog_manager =
177 ConstrainedWindowTabHelper::FromWebContents(contents); 177 WebContentsModalDialogManager::FromWebContents(contents);
178 if (!constrained_window_tab_helper) { 178 if (!web_contents_dialog_manager) {
179 // If there is no ConstrainedWindowTabHelper, then this contents is probably 179 // If there is no WebContentsModalDialogManager, then this contents is
180 // the background page for an app. Try to find a shell window to host the 180 // probably the background page for an app. Try to find a shell window to
181 // dialog. 181 // host the dialog.
182 ShellWindow* window = ShellWindowRegistry::Get(profile())-> 182 ShellWindow* window = ShellWindowRegistry::Get(profile())->
183 GetCurrentShellWindowForApp(GetExtension()->id()); 183 GetCurrentShellWindowForApp(GetExtension()->id());
184 if (window) { 184 if (window) {
185 contents = window->web_contents(); 185 contents = window->web_contents();
186 } else { 186 } else {
187 // Abort showing the dialog. TODO(estade) Perhaps return an error instead. 187 // Abort showing the dialog. TODO(estade) Perhaps return an error instead.
188 GetAndReturnGalleries(); 188 GetAndReturnGalleries();
189 return; 189 return;
190 } 190 }
191 } 191 }
(...skipping 12 matching lines...) Expand all
204 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() { 204 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() {
205 if (!ApiIsAccessible(&error_)) 205 if (!ApiIsAccessible(&error_))
206 return false; 206 return false;
207 207
208 // TODO(vandebo) Update the metadata and return the new file. 208 // TODO(vandebo) Update the metadata and return the new file.
209 SetResult(Value::CreateNullValue()); 209 SetResult(Value::CreateNullValue());
210 return true; 210 return true;
211 } 211 }
212 212
213 } // namespace extensions 213 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/download/download_danger_prompt.h ('k') | chrome/browser/extensions/platform_app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698