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

Side by Side Diff: ui/shell_dialogs/select_file_dialog_win.cc

Issue 246633004: Remove non USE_AURA code from views files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Just revert changes to ui/app_list/. Created 6 years, 8 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 | « ui/message_center/views/toast_contents_view.cc ('k') | no next file » | 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) 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 "ui/shell_dialogs/select_file_dialog_win.h" 5 #include "ui/shell_dialogs/select_file_dialog_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <commdlg.h> 8 #include <commdlg.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 10
11 #include <algorithm> 11 #include <algorithm>
12 #include <set> 12 #include <set>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/i18n/case_conversion.h" 17 #include "base/i18n/case_conversion.h"
18 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
19 #include "base/message_loop/message_loop_proxy.h" 19 #include "base/message_loop/message_loop_proxy.h"
20 #include "base/strings/string_split.h" 20 #include "base/strings/string_split.h"
21 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
22 #include "base/threading/thread.h" 22 #include "base/threading/thread.h"
23 #include "base/win/metro.h" 23 #include "base/win/metro.h"
24 #include "base/win/registry.h" 24 #include "base/win/registry.h"
25 #include "base/win/scoped_comptr.h" 25 #include "base/win/scoped_comptr.h"
26 #include "base/win/shortcut.h" 26 #include "base/win/shortcut.h"
27 #include "base/win/windows_version.h" 27 #include "base/win/windows_version.h"
28 #include "grit/ui_strings.h" 28 #include "grit/ui_strings.h"
29 #include "ui/aura/remote_window_tree_host_win.h"
30 #include "ui/aura/window.h"
31 #include "ui/aura/window_event_dispatcher.h"
29 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
30 #include "ui/gfx/native_widget_types.h" 33 #include "ui/gfx/native_widget_types.h"
31 #include "ui/shell_dialogs/base_shell_dialog_win.h" 34 #include "ui/shell_dialogs/base_shell_dialog_win.h"
32 #include "ui/shell_dialogs/shell_dialogs_delegate.h" 35 #include "ui/shell_dialogs/shell_dialogs_delegate.h"
33 36
34 #if defined(USE_AURA)
35 #include "ui/aura/remote_window_tree_host_win.h"
36 #include "ui/aura/window.h"
37 #include "ui/aura/window_event_dispatcher.h"
38 #endif
39
40 namespace { 37 namespace {
41 38
42 // Given |extension|, if it's not empty, then remove the leading dot. 39 // Given |extension|, if it's not empty, then remove the leading dot.
43 std::wstring GetExtensionWithoutLeadingDot(const std::wstring& extension) { 40 std::wstring GetExtensionWithoutLeadingDot(const std::wstring& extension) {
44 DCHECK(extension.empty() || extension[0] == L'.'); 41 DCHECK(extension.empty() || extension[0] == L'.');
45 return extension.empty() ? extension : extension.substr(1); 42 return extension.empty() ? extension : extension.substr(1);
46 } 43 }
47 44
48 // Diverts to a metro-specific implementation as appropriate. 45 // Diverts to a metro-specific implementation as appropriate.
49 bool CallGetOpenFileName(OPENFILENAME* ofn) { 46 bool CallGetOpenFileName(OPENFILENAME* ofn) {
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 Type type, 536 Type type,
540 const base::string16& title, 537 const base::string16& title,
541 const base::FilePath& default_path, 538 const base::FilePath& default_path,
542 const FileTypeInfo* file_types, 539 const FileTypeInfo* file_types,
543 int file_type_index, 540 int file_type_index,
544 const base::FilePath::StringType& default_extension, 541 const base::FilePath::StringType& default_extension,
545 gfx::NativeWindow owning_window, 542 gfx::NativeWindow owning_window,
546 void* params) { 543 void* params) {
547 has_multiple_file_type_choices_ = 544 has_multiple_file_type_choices_ =
548 file_types ? file_types->extensions.size() > 1 : true; 545 file_types ? file_types->extensions.size() > 1 : true;
549 #if defined(USE_AURA)
550 // If the owning_window passed in is in metro then we need to forward the 546 // If the owning_window passed in is in metro then we need to forward the
551 // file open/save operations to metro. 547 // file open/save operations to metro.
552 if (GetShellDialogsDelegate() && 548 if (GetShellDialogsDelegate() &&
553 GetShellDialogsDelegate()->IsWindowInMetro(owning_window)) { 549 GetShellDialogsDelegate()->IsWindowInMetro(owning_window)) {
554 if (type == SELECT_SAVEAS_FILE) { 550 if (type == SELECT_SAVEAS_FILE) {
555 aura::HandleSaveFile( 551 aura::HandleSaveFile(
556 base::UTF16ToWide(title), 552 base::UTF16ToWide(title),
557 default_path, 553 default_path,
558 GetFilterForFileTypes(file_types), 554 GetFilterForFileTypes(file_types),
559 file_type_index, 555 file_type_index,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 base::UTF16ToWide(title_string), 591 base::UTF16ToWide(title_string),
596 base::Bind(&ui::SelectFileDialog::Listener::FileSelected, 592 base::Bind(&ui::SelectFileDialog::Listener::FileSelected,
597 base::Unretained(listener_)), 593 base::Unretained(listener_)),
598 base::Bind(&ui::SelectFileDialog::Listener::FileSelectionCanceled, 594 base::Bind(&ui::SelectFileDialog::Listener::FileSelectionCanceled,
599 base::Unretained(listener_))); 595 base::Unretained(listener_)));
600 return; 596 return;
601 } 597 }
602 } 598 }
603 HWND owner = owning_window && owning_window->GetRootWindow() 599 HWND owner = owning_window && owning_window->GetRootWindow()
604 ? owning_window->GetHost()->GetAcceleratedWidget() : NULL; 600 ? owning_window->GetHost()->GetAcceleratedWidget() : NULL;
605 #else 601
606 HWND owner = owning_window;
607 #endif
608 ExecuteSelectParams execute_params(type, base::UTF16ToWide(title), 602 ExecuteSelectParams execute_params(type, base::UTF16ToWide(title),
609 default_path, file_types, file_type_index, 603 default_path, file_types, file_type_index,
610 default_extension, BeginRun(owner), 604 default_extension, BeginRun(owner),
611 owner, params); 605 owner, params);
612 execute_params.run_state.dialog_thread->message_loop()->PostTask( 606 execute_params.run_state.dialog_thread->message_loop()->PostTask(
613 FROM_HERE, 607 FROM_HERE,
614 base::Bind(&SelectFileDialogImpl::ExecuteSelectFile, this, 608 base::Bind(&SelectFileDialogImpl::ExecuteSelectFile, this,
615 execute_params)); 609 execute_params));
616 } 610 }
617 611
618 bool SelectFileDialogImpl::HasMultipleFileTypeChoicesImpl() { 612 bool SelectFileDialogImpl::HasMultipleFileTypeChoicesImpl() {
619 return has_multiple_file_type_choices_; 613 return has_multiple_file_type_choices_;
620 } 614 }
621 615
622 bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow owning_window) const { 616 bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow owning_window) const {
623 #if defined(USE_AURA)
624 if (!owning_window->GetRootWindow()) 617 if (!owning_window->GetRootWindow())
625 return false; 618 return false;
626 HWND owner = owning_window->GetHost()->GetAcceleratedWidget(); 619 HWND owner = owning_window->GetHost()->GetAcceleratedWidget();
627 #else
628 HWND owner = owning_window;
629 #endif
630 return listener_ && IsRunningDialogForOwner(owner); 620 return listener_ && IsRunningDialogForOwner(owner);
631 } 621 }
632 622
633 void SelectFileDialogImpl::ListenerDestroyed() { 623 void SelectFileDialogImpl::ListenerDestroyed() {
634 // Our associated listener has gone away, so we shouldn't call back to it if 624 // Our associated listener has gone away, so we shouldn't call back to it if
635 // our worker thread returns after the listener is dead. 625 // our worker thread returns after the listener is dead.
636 listener_ = NULL; 626 listener_ = NULL;
637 } 627 }
638 628
639 void SelectFileDialogImpl::ExecuteSelectFile( 629 void SelectFileDialogImpl::ExecuteSelectFile(
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 return return_value; 939 return return_value;
950 } 940 }
951 941
952 SelectFileDialog* CreateWinSelectFileDialog( 942 SelectFileDialog* CreateWinSelectFileDialog(
953 SelectFileDialog::Listener* listener, 943 SelectFileDialog::Listener* listener,
954 SelectFilePolicy* policy) { 944 SelectFilePolicy* policy) {
955 return new SelectFileDialogImpl(listener, policy); 945 return new SelectFileDialogImpl(listener, policy);
956 } 946 }
957 947
958 } // namespace ui 948 } // namespace ui
OLDNEW
« no previous file with comments | « ui/message_center/views/toast_contents_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698