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

Side by Side Diff: chrome/browser/extensions/api/file_system/file_system_api.cc

Issue 12334073: Remove WebContents methods that duplicate WebContentsView methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 #include "chrome/browser/extensions/api/file_system/file_system_api.h" 5 #include "chrome/browser/extensions/api/file_system/file_system_api.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/sys_string_conversions.h" 13 #include "base/sys_string_conversions.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/extensions/shell_window_registry.h" 15 #include "chrome/browser/extensions/shell_window_registry.h"
16 #include "chrome/browser/platform_util.h" 16 #include "chrome/browser/platform_util.h"
17 #include "chrome/browser/ui/chrome_select_file_policy.h" 17 #include "chrome/browser/ui/chrome_select_file_policy.h"
18 #include "chrome/browser/ui/extensions/shell_window.h" 18 #include "chrome/browser/ui/extensions/shell_window.h"
19 #include "chrome/common/extensions/api/file_system.h" 19 #include "chrome/common/extensions/api/file_system.h"
20 #include "chrome/common/extensions/permissions/api_permission.h" 20 #include "chrome/common/extensions/permissions/api_permission.h"
21 #include "content/public/browser/child_process_security_policy.h" 21 #include "content/public/browser/child_process_security_policy.h"
22 #include "content/public/browser/render_process_host.h" 22 #include "content/public/browser/render_process_host.h"
23 #include "content/public/browser/render_view_host.h" 23 #include "content/public/browser/render_view_host.h"
24 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
25 #include "content/public/browser/web_contents_view.h"
25 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
26 #include "net/base/mime_util.h" 27 #include "net/base/mime_util.h"
27 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
28 #include "ui/shell_dialogs/select_file_dialog.h" 29 #include "ui/shell_dialogs/select_file_dialog.h"
29 #include "webkit/fileapi/file_system_types.h" 30 #include "webkit/fileapi/file_system_types.h"
30 #include "webkit/fileapi/file_system_util.h" 31 #include "webkit/fileapi/file_system_util.h"
31 #include "webkit/fileapi/isolated_context.h" 32 #include "webkit/fileapi/isolated_context.h"
32 33
33 #if defined(OS_MACOSX) 34 #if defined(OS_MACOSX)
34 #include <CoreFoundation/CoreFoundation.h> 35 #include <CoreFoundation/CoreFoundation.h>
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 const base::FilePath& suggested_name, 384 const base::FilePath& suggested_name,
384 const ui::SelectFileDialog::FileTypeInfo& file_type_info, 385 const ui::SelectFileDialog::FileTypeInfo& file_type_info,
385 ui::SelectFileDialog::Type picker_type, 386 ui::SelectFileDialog::Type picker_type,
386 EntryType entry_type) 387 EntryType entry_type)
387 : suggested_name_(suggested_name), 388 : suggested_name_(suggested_name),
388 entry_type_(entry_type), 389 entry_type_(entry_type),
389 function_(function) { 390 function_(function) {
390 select_file_dialog_ = ui::SelectFileDialog::Create( 391 select_file_dialog_ = ui::SelectFileDialog::Create(
391 this, new ChromeSelectFilePolicy(web_contents)); 392 this, new ChromeSelectFilePolicy(web_contents));
392 gfx::NativeWindow owning_window = web_contents ? 393 gfx::NativeWindow owning_window = web_contents ?
393 platform_util::GetTopLevel(web_contents->GetNativeView()) : NULL; 394 platform_util::GetTopLevel(web_contents->GetView()->GetNativeView()) :
395 NULL;
394 396
395 if (g_skip_picker_for_test) { 397 if (g_skip_picker_for_test) {
396 if (g_path_to_be_picked_for_test) { 398 if (g_path_to_be_picked_for_test) {
397 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 399 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
398 base::Bind( 400 base::Bind(
399 &FileSystemChooseEntryFunction::FilePicker::FileSelected, 401 &FileSystemChooseEntryFunction::FilePicker::FileSelected,
400 base::Unretained(this), *g_path_to_be_picked_for_test, 1, 402 base::Unretained(this), *g_path_to_be_picked_for_test, 1,
401 static_cast<void*>(NULL))); 403 static_cast<void*>(NULL)));
402 } else { 404 } else {
403 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 405 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 597
596 if (entry_type == WRITABLE && !HasFileSystemWritePermission()) { 598 if (entry_type == WRITABLE && !HasFileSystemWritePermission()) {
597 error_ = kRequiresFileSystemWriteError; 599 error_ = kRequiresFileSystemWriteError;
598 return false; 600 return false;
599 } 601 }
600 602
601 return ShowPicker(suggested_name, file_type_info, picker_type, entry_type); 603 return ShowPicker(suggested_name, file_type_info, picker_type, entry_type);
602 } 604 }
603 605
604 } // namespace extensions 606 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/downloads/downloads_api.cc ('k') | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698