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

Side by Side Diff: chrome/browser/ui/views/file_manager_dialog.cc

Issue 7941014: Use extension-based file picker from CrOS for Aura builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux_touchui Created 9 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/views/shell_dialogs_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/views/file_manager_dialog.h" 5 #include "chrome/browser/ui/views/file_manager_dialog.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "chrome/browser/extensions/extension_file_browser_private_api.h" 9 #include "chrome/browser/extensions/extension_file_browser_private_api.h"
10 #include "chrome/browser/extensions/extension_host.h" 10 #include "chrome/browser/extensions/extension_host.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 LOG(WARNING) << "Pending dialog not found " << tab_id; 66 LOG(WARNING) << "Pending dialog not found " << tab_id;
67 return NULL; 67 return NULL;
68 } 68 }
69 return it->second.dialog_.get(); 69 return it->second.dialog_.get();
70 } 70 }
71 71
72 } // namespace 72 } // namespace
73 73
74 // Linking this implementation of SelectFileDialog::Create into the target 74 // Linking this implementation of SelectFileDialog::Create into the target
75 // selects FileManagerDialog as the dialog of choice. 75 // selects FileManagerDialog as the dialog of choice.
76 // TODO(jamescook): Move this into a new file shell_dialogs_chromeos.cc
76 // static 77 // static
77 SelectFileDialog* SelectFileDialog::Create(Listener* listener) { 78 SelectFileDialog* SelectFileDialog::Create(Listener* listener) {
78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
79 return new FileManagerDialog(listener); 80 return new FileManagerDialog(listener);
80 } 81 }
81 82
82 ///////////////////////////////////////////////////////////////////////////// 83 /////////////////////////////////////////////////////////////////////////////
83 84
84 FileManagerDialog::FileManagerDialog(Listener* listener) 85 FileManagerDialog::FileManagerDialog(Listener* listener)
85 : SelectFileDialog(listener), 86 : SelectFileDialog(listener),
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 NOTREACHED() << "Can't find owning browser"; 176 NOTREACHED() << "Can't find owning browser";
176 return; 177 return;
177 } 178 }
178 179
179 FilePath virtual_path; 180 FilePath virtual_path;
180 if (!FileManagerUtil::ConvertFileToRelativeFileSystemPath( 181 if (!FileManagerUtil::ConvertFileToRelativeFileSystemPath(
181 owner_browser->profile(), default_path, &virtual_path)) { 182 owner_browser->profile(), default_path, &virtual_path)) {
182 virtual_path = FilePath(); 183 virtual_path = FilePath();
183 } 184 }
184 185
185 // Connect our listener to FileDialogFunction's per-tab callbacks.
186 TabContentsWrapper* tab = owner_browser->GetSelectedTabContentsWrapper();
187 int32 tab_id = (tab ? tab->restore_tab_helper()->session_id().id() : 0);
188 PendingDialog::Add(tab_id, this);
189
190 GURL file_browser_url = FileManagerUtil::GetFileBrowserUrlWithParams( 186 GURL file_browser_url = FileManagerUtil::GetFileBrowserUrlWithParams(
191 type, title, virtual_path, file_types, file_type_index, 187 type, title, virtual_path, file_types, file_type_index,
192 default_extension); 188 default_extension);
193 extension_dialog_ = ExtensionDialog::Show(file_browser_url, 189 TabContentsWrapper* tab = owner_browser->GetSelectedTabContentsWrapper();
190 ExtensionDialog* dialog = ExtensionDialog::Show(file_browser_url,
194 owner_browser, tab->tab_contents(), 191 owner_browser, tab->tab_contents(),
195 kFileManagerWidth, kFileManagerHeight, 192 kFileManagerWidth, kFileManagerHeight,
196 this /* ExtensionDialog::Observer */); 193 this /* ExtensionDialog::Observer */);
194 if (!dialog) {
195 LOG(ERROR) << "Unable to create extension dialog";
196 return;
197 }
197 198
199 // Connect our listener to FileDialogFunction's per-tab callbacks.
200 int32 tab_id = (tab ? tab->restore_tab_helper()->session_id().id() : 0);
201 PendingDialog::Add(tab_id, this);
202
203 extension_dialog_ = dialog;
198 params_ = params; 204 params_ = params;
199 tab_id_ = tab_id; 205 tab_id_ = tab_id;
200 owner_window_ = owner_window; 206 owner_window_ = owner_window;
201 } 207 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/views/shell_dialogs_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698