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

Side by Side Diff: chrome/browser/ui/chrome_select_file_policy_unittest.cc

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 "chrome/browser/ui/chrome_select_file_policy.h" 5 #include "chrome/browser/ui/chrome_select_file_policy.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 18 matching lines...) Expand all
29 using content::BrowserThread; 29 using content::BrowserThread;
30 30
31 namespace { 31 namespace {
32 32
33 class FileSelectionUser : public ui::SelectFileDialog::Listener { 33 class FileSelectionUser : public ui::SelectFileDialog::Listener {
34 public: 34 public:
35 FileSelectionUser() 35 FileSelectionUser()
36 : file_selection_initialisation_in_progress(false) { 36 : file_selection_initialisation_in_progress(false) {
37 } 37 }
38 38
39 virtual ~FileSelectionUser() { 39 ~FileSelectionUser() override {
40 if (select_file_dialog_.get()) 40 if (select_file_dialog_.get())
41 select_file_dialog_->ListenerDestroyed(); 41 select_file_dialog_->ListenerDestroyed();
42 } 42 }
43 43
44 void StartFileSelection() { 44 void StartFileSelection() {
45 CHECK(!select_file_dialog_.get()); 45 CHECK(!select_file_dialog_.get());
46 select_file_dialog_ = ui::SelectFileDialog::Create( 46 select_file_dialog_ = ui::SelectFileDialog::Create(
47 this, new ChromeSelectFilePolicy(NULL)); 47 this, new ChromeSelectFilePolicy(NULL));
48 48
49 const base::FilePath file_path; 49 const base::FilePath file_path;
50 const base::string16 title = base::string16(); 50 const base::string16 title = base::string16();
51 51
52 file_selection_initialisation_in_progress = true; 52 file_selection_initialisation_in_progress = true;
53 select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_OPEN_FILE, 53 select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_OPEN_FILE,
54 title, 54 title,
55 file_path, 55 file_path,
56 NULL, 56 NULL,
57 0, 57 0,
58 base::FilePath::StringType(), 58 base::FilePath::StringType(),
59 NULL, 59 NULL,
60 NULL); 60 NULL);
61 file_selection_initialisation_in_progress = false; 61 file_selection_initialisation_in_progress = false;
62 } 62 }
63 63
64 // ui::SelectFileDialog::Listener implementation. 64 // ui::SelectFileDialog::Listener implementation.
65 virtual void FileSelected(const base::FilePath& path, 65 void FileSelected(const base::FilePath& path,
66 int index, void* params) override { 66 int index,
67 void* params) override {
67 ASSERT_FALSE(file_selection_initialisation_in_progress); 68 ASSERT_FALSE(file_selection_initialisation_in_progress);
68 } 69 }
69 virtual void MultiFilesSelected( 70 void MultiFilesSelected(const std::vector<base::FilePath>& files,
70 const std::vector<base::FilePath>& files, 71 void* params) override {
71 void* params) override {
72 ASSERT_FALSE(file_selection_initialisation_in_progress); 72 ASSERT_FALSE(file_selection_initialisation_in_progress);
73 } 73 }
74 virtual void FileSelectionCanceled(void* params) override { 74 void FileSelectionCanceled(void* params) override {
75 ASSERT_FALSE(file_selection_initialisation_in_progress); 75 ASSERT_FALSE(file_selection_initialisation_in_progress);
76 } 76 }
77 77
78 private: 78 private:
79 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; 79 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
80 80
81 bool file_selection_initialisation_in_progress; 81 bool file_selection_initialisation_in_progress;
82 }; 82 };
83 83
84 } // namespace 84 } // namespace
(...skipping 10 matching lines...) Expand all
95 TestingBrowserProcess::GetGlobal()); 95 TestingBrowserProcess::GetGlobal());
96 96
97 scoped_ptr<FileSelectionUser> file_selection_user(new FileSelectionUser()); 97 scoped_ptr<FileSelectionUser> file_selection_user(new FileSelectionUser());
98 98
99 // Disallow file-selection dialogs. 99 // Disallow file-selection dialogs.
100 local_state.Get()->SetManagedPref(prefs::kAllowFileSelectionDialogs, 100 local_state.Get()->SetManagedPref(prefs::kAllowFileSelectionDialogs,
101 new base::FundamentalValue(false)); 101 new base::FundamentalValue(false));
102 102
103 file_selection_user->StartFileSelection(); 103 file_selection_user->StartFileSelection();
104 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698