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/developer_private/entry_picker.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, 9 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/developer_private/entry_picker.h" 5 #include "chrome/browser/extensions/api/developer_private/entry_picker.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/string_util.h" 10 #include "base/string_util.h"
11 #include "chrome/browser/extensions/api/developer_private/developer_private_api. h" 11 #include "chrome/browser/extensions/api/developer_private/developer_private_api. h"
12 #include "chrome/browser/extensions/shell_window_registry.h" 12 #include "chrome/browser/extensions/shell_window_registry.h"
13 #include "chrome/browser/platform_util.h" 13 #include "chrome/browser/platform_util.h"
14 #include "chrome/browser/ui/chrome_select_file_policy.h" 14 #include "chrome/browser/ui/chrome_select_file_policy.h"
15 #include "chrome/browser/ui/extensions/shell_window.h" 15 #include "chrome/browser/ui/extensions/shell_window.h"
16 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "content/public/browser/web_contents_view.h"
17 #include "ui/shell_dialogs/select_file_dialog.h" 18 #include "ui/shell_dialogs/select_file_dialog.h"
18 19
19 namespace { 20 namespace {
20 21
21 bool g_skip_picker_for_test = false; 22 bool g_skip_picker_for_test = false;
22 base::FilePath* g_path_to_be_picked_for_test = NULL; 23 base::FilePath* g_path_to_be_picked_for_test = NULL;
23 24
24 } // namespace 25 } // namespace
25 26
26 namespace extensions { 27 namespace extensions {
27 28
28 namespace api { 29 namespace api {
29 30
30 EntryPicker::EntryPicker(EntryPickerClient* client, 31 EntryPicker::EntryPicker(EntryPickerClient* client,
31 content::WebContents* web_contents, 32 content::WebContents* web_contents,
32 ui::SelectFileDialog::Type picker_type, 33 ui::SelectFileDialog::Type picker_type,
33 const base::FilePath& last_directory, 34 const base::FilePath& last_directory,
34 const string16& select_title, 35 const string16& select_title,
35 const ui::SelectFileDialog::FileTypeInfo& info, 36 const ui::SelectFileDialog::FileTypeInfo& info,
36 int file_type_index) 37 int file_type_index)
37 : client_(client) { 38 : client_(client) {
38 select_file_dialog_ = ui::SelectFileDialog::Create( 39 select_file_dialog_ = ui::SelectFileDialog::Create(
39 this, new ChromeSelectFilePolicy(web_contents)); 40 this, new ChromeSelectFilePolicy(web_contents));
40 41
41 gfx::NativeWindow owning_window = web_contents ? 42 gfx::NativeWindow owning_window = web_contents ?
42 platform_util::GetTopLevel(web_contents->GetNativeView()) : NULL; 43 platform_util::GetTopLevel(web_contents->GetView()->GetNativeView()) :
44 NULL;
43 45
44 if (g_skip_picker_for_test) { 46 if (g_skip_picker_for_test) {
45 if (g_path_to_be_picked_for_test) { 47 if (g_path_to_be_picked_for_test) {
46 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 48 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
47 base::Bind( 49 base::Bind(
48 &EntryPicker::FileSelected, 50 &EntryPicker::FileSelected,
49 base::Unretained(this), *g_path_to_be_picked_for_test, 1, 51 base::Unretained(this), *g_path_to_be_picked_for_test, 1,
50 static_cast<void*>(NULL))); 52 static_cast<void*>(NULL)));
51 } else { 53 } else {
52 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 54 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 96 }
95 97
96 // static 98 // static
97 void EntryPicker::StopSkippingPickerForTest() { 99 void EntryPicker::StopSkippingPickerForTest() {
98 g_skip_picker_for_test = false; 100 g_skip_picker_for_test = false;
99 } 101 }
100 102
101 } // namespace api 103 } // namespace api
102 104
103 } // namespace extensions 105 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698