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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 void FileSelectHelper::RunFileChooser( | 241 void FileSelectHelper::RunFileChooser( |
242 RenderViewHost* render_view_host, | 242 RenderViewHost* render_view_host, |
243 TabContents* tab_contents, | 243 TabContents* tab_contents, |
244 const ViewHostMsg_RunFileChooser_Params& params) { | 244 const ViewHostMsg_RunFileChooser_Params& params) { |
245 DCHECK(!render_view_host_); | 245 DCHECK(!render_view_host_); |
246 render_view_host_ = render_view_host; | 246 render_view_host_ = render_view_host; |
247 notification_registrar_.RemoveAll(); | 247 notification_registrar_.RemoveAll(); |
248 notification_registrar_.Add( | 248 notification_registrar_.Add( |
249 this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 249 this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
250 Source<RenderViewHost>(render_view_host)); | 250 Source<RenderWidgetHost>(render_view_host)); |
251 | 251 |
252 if (!select_file_dialog_.get()) | 252 if (!select_file_dialog_.get()) |
253 select_file_dialog_ = SelectFileDialog::Create(this); | 253 select_file_dialog_ = SelectFileDialog::Create(this); |
254 | 254 |
255 switch (params.mode) { | 255 switch (params.mode) { |
256 case ViewHostMsg_RunFileChooser_Mode::Open: | 256 case ViewHostMsg_RunFileChooser_Mode::Open: |
257 dialog_type_ = SelectFileDialog::SELECT_OPEN_FILE; | 257 dialog_type_ = SelectFileDialog::SELECT_OPEN_FILE; |
258 break; | 258 break; |
259 case ViewHostMsg_RunFileChooser_Mode::OpenMultiple: | 259 case ViewHostMsg_RunFileChooser_Mode::OpenMultiple: |
260 dialog_type_ = SelectFileDialog::SELECT_OPEN_MULTI_FILE; | 260 dialog_type_ = SelectFileDialog::SELECT_OPEN_MULTI_FILE; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 RenderViewHost* render_view_host, | 293 RenderViewHost* render_view_host, |
294 const FilePath& path) { | 294 const FilePath& path) { |
295 DCHECK_NE(kFileSelectEnumerationId, request_id); | 295 DCHECK_NE(kFileSelectEnumerationId, request_id); |
296 StartNewEnumeration(path, request_id, render_view_host); | 296 StartNewEnumeration(path, request_id, render_view_host); |
297 } | 297 } |
298 | 298 |
299 void FileSelectHelper::Observe(int type, | 299 void FileSelectHelper::Observe(int type, |
300 const NotificationSource& source, | 300 const NotificationSource& source, |
301 const NotificationDetails& details) { | 301 const NotificationDetails& details) { |
302 DCHECK(type == content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED); | 302 DCHECK(type == content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED); |
303 DCHECK(Details<RenderViewHost>(details).ptr() == render_view_host_); | 303 DCHECK(Source<RenderWidgetHost>(source).ptr() == render_view_host_); |
304 render_view_host_ = NULL; | 304 render_view_host_ = NULL; |
305 } | 305 } |
306 | 306 |
OLD | NEW |