OLD | NEW |
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/file_select_helper.h" | 5 #include "chrome/browser/file_select_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 return file_type.release(); | 231 return file_type.release(); |
232 } | 232 } |
233 | 233 |
234 void FileSelectHelper::RunFileChooser( | 234 void FileSelectHelper::RunFileChooser( |
235 RenderViewHost* render_view_host, | 235 RenderViewHost* render_view_host, |
236 TabContents* tab_contents, | 236 TabContents* tab_contents, |
237 const ViewHostMsg_RunFileChooser_Params& params) { | 237 const ViewHostMsg_RunFileChooser_Params& params) { |
238 DCHECK(!render_view_host_); | 238 DCHECK(!render_view_host_); |
239 render_view_host_ = render_view_host; | 239 render_view_host_ = render_view_host; |
240 notification_registrar_.RemoveAll(); | 240 notification_registrar_.RemoveAll(); |
241 notification_registrar_.Add(this, | 241 notification_registrar_.Add( |
242 NotificationType::RENDER_WIDGET_HOST_DESTROYED, | 242 this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
243 Source<RenderViewHost>(render_view_host)); | 243 Source<RenderViewHost>(render_view_host)); |
244 | 244 |
245 if (!select_file_dialog_.get()) | 245 if (!select_file_dialog_.get()) |
246 select_file_dialog_ = SelectFileDialog::Create(this); | 246 select_file_dialog_ = SelectFileDialog::Create(this); |
247 | 247 |
248 switch (params.mode) { | 248 switch (params.mode) { |
249 case ViewHostMsg_RunFileChooser_Mode::Open: | 249 case ViewHostMsg_RunFileChooser_Mode::Open: |
250 dialog_type_ = SelectFileDialog::SELECT_OPEN_FILE; | 250 dialog_type_ = SelectFileDialog::SELECT_OPEN_FILE; |
251 break; | 251 break; |
252 case ViewHostMsg_RunFileChooser_Mode::OpenMultiple: | 252 case ViewHostMsg_RunFileChooser_Mode::OpenMultiple: |
253 dialog_type_ = SelectFileDialog::SELECT_OPEN_MULTI_FILE; | 253 dialog_type_ = SelectFileDialog::SELECT_OPEN_MULTI_FILE; |
(...skipping 28 matching lines...) Expand all Loading... |
282 NULL); | 282 NULL); |
283 } | 283 } |
284 | 284 |
285 void FileSelectHelper::EnumerateDirectory(int request_id, | 285 void FileSelectHelper::EnumerateDirectory(int request_id, |
286 RenderViewHost* render_view_host, | 286 RenderViewHost* render_view_host, |
287 const FilePath& path) { | 287 const FilePath& path) { |
288 DCHECK_NE(kFileSelectEnumerationId, request_id); | 288 DCHECK_NE(kFileSelectEnumerationId, request_id); |
289 StartNewEnumeration(path, request_id, render_view_host); | 289 StartNewEnumeration(path, request_id, render_view_host); |
290 } | 290 } |
291 | 291 |
292 void FileSelectHelper::Observe(NotificationType type, | 292 void FileSelectHelper::Observe(int type, |
293 const NotificationSource& source, | 293 const NotificationSource& source, |
294 const NotificationDetails& details) { | 294 const NotificationDetails& details) { |
295 DCHECK(type == NotificationType::RENDER_WIDGET_HOST_DESTROYED); | 295 DCHECK(type == content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED); |
296 DCHECK(Details<RenderViewHost>(details).ptr() == render_view_host_); | 296 DCHECK(Details<RenderViewHost>(details).ptr() == render_view_host_); |
297 render_view_host_ = NULL; | 297 render_view_host_ = NULL; |
298 } | 298 } |
299 | 299 |
300 FileSelectObserver::FileSelectObserver(TabContents* tab_contents) | 300 FileSelectObserver::FileSelectObserver(TabContents* tab_contents) |
301 : TabContentsObserver(tab_contents) { | 301 : TabContentsObserver(tab_contents) { |
302 } | 302 } |
303 | 303 |
304 FileSelectObserver::~FileSelectObserver() { | 304 FileSelectObserver::~FileSelectObserver() { |
305 } | 305 } |
(...skipping 27 matching lines...) Expand all Loading... |
333 path)) { | 333 path)) { |
334 return; | 334 return; |
335 } | 335 } |
336 | 336 |
337 if (!file_select_helper_.get()) | 337 if (!file_select_helper_.get()) |
338 file_select_helper_.reset(new FileSelectHelper(tab_contents()->profile())); | 338 file_select_helper_.reset(new FileSelectHelper(tab_contents()->profile())); |
339 file_select_helper_->EnumerateDirectory(request_id, | 339 file_select_helper_->EnumerateDirectory(request_id, |
340 tab_contents()->render_view_host(), | 340 tab_contents()->render_view_host(), |
341 path); | 341 path); |
342 } | 342 } |
OLD | NEW |