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/shell_dialogs.h" | 5 #include "chrome/browser/ui/shell_dialogs.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/browser_list.h" | 15 #include "chrome/browser/browser_list.h" |
16 #include "chrome/browser/browser_thread.h" | 16 #include "chrome/browser/browser_thread.h" |
17 #include "chrome/browser/dom_ui/html_dialog_ui.h" | 17 #include "chrome/browser/dom_ui/html_dialog_ui.h" |
18 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
19 #include "chrome/browser/shell_dialogs.h" | |
20 #include "chrome/browser/tab_contents/tab_contents.h" | 19 #include "chrome/browser/tab_contents/tab_contents.h" |
21 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
22 #include "chrome/browser/ui/browser_dialogs.h" | 21 #include "chrome/browser/ui/browser_dialogs.h" |
23 #include "chrome/browser/ui/views/html_dialog_view.h" | 22 #include "chrome/browser/ui/views/html_dialog_view.h" |
24 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
25 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
26 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
27 #include "views/window/non_client_view.h" | 26 #include "views/window/non_client_view.h" |
28 #include "views/window/window.h" | 27 #include "views/window/window.h" |
29 | 28 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 return; | 367 return; |
369 } | 368 } |
370 | 369 |
371 void SelectFileDialogImpl::FileBrowseDelegate::GetDialogSize( | 370 void SelectFileDialogImpl::FileBrowseDelegate::GetDialogSize( |
372 gfx::Size* size) const { | 371 gfx::Size* size) const { |
373 size->SetSize(320, 240); | 372 size->SetSize(320, 240); |
374 } | 373 } |
375 | 374 |
376 std::string SelectFileDialogImpl::FileBrowseDelegate::GetDialogArgs() const { | 375 std::string SelectFileDialogImpl::FileBrowseDelegate::GetDialogArgs() const { |
377 // SelectFile inputs as json. | 376 // SelectFile inputs as json. |
378 // { | 377 // { |
379 // "type" : "open", // (or "open_multiple", "save", "folder" | 378 // "type" : "open", // (or "open_multiple", "save", "folder" |
380 // "all_files" : true, | 379 // "all_files" : true, |
381 // "file_types" : { | 380 // "file_types" : { |
382 // "exts" : [ ["htm", "html"], ["txt"] ], | 381 // "exts" : [ ["htm", "html"], ["txt"] ], |
383 // "desc" : [ "HTML files", "Text files" ], | 382 // "desc" : [ "HTML files", "Text files" ], |
384 // }, | 383 // }, |
385 // "file_type_index" : 1, // 1-based file type index. | 384 // "file_type_index" : 1, // 1-based file type index. |
386 // } | 385 // } |
387 // See browser/shell_dialogs.h for more details. | 386 // See browser/ui/shell_dialogs.h for more details. |
388 | 387 |
389 std::string type_string; | 388 std::string type_string; |
390 switch (type_) { | 389 switch (type_) { |
391 case SELECT_FOLDER: | 390 case SELECT_FOLDER: |
392 type_string = "folder"; | 391 type_string = "folder"; |
393 break; | 392 break; |
394 case SELECT_OPEN_FILE: | 393 case SELECT_OPEN_FILE: |
395 type_string = "open"; | 394 type_string = "open"; |
396 break; | 395 break; |
397 case SELECT_OPEN_MULTI_FILE: | 396 case SELECT_OPEN_MULTI_FILE: |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 // TODO(xiyuan): Change this when the infrastructure is improved. | 487 // TODO(xiyuan): Change this when the infrastructure is improved. |
489 HtmlDialogUIDelegate** delegate = HtmlDialogUI::GetPropertyAccessor(). | 488 HtmlDialogUIDelegate** delegate = HtmlDialogUI::GetPropertyAccessor(). |
490 GetProperty(dom_ui_->tab_contents()->property_bag()); | 489 GetProperty(dom_ui_->tab_contents()->property_bag()); |
491 HtmlDialogView* containing_view = static_cast<HtmlDialogView*>(*delegate); | 490 HtmlDialogView* containing_view = static_cast<HtmlDialogView*>(*delegate); |
492 DCHECK(containing_view); | 491 DCHECK(containing_view); |
493 | 492 |
494 containing_view->GetWindow()->UpdateWindowTitle(); | 493 containing_view->GetWindow()->UpdateWindowTitle(); |
495 containing_view->GetWindow()->GetNonClientView()->SchedulePaint(); | 494 containing_view->GetWindow()->GetNonClientView()->SchedulePaint(); |
496 } | 495 } |
497 } | 496 } |
OLD | NEW |