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

Side by Side Diff: chrome/browser/ui/gtk/select_file_dialog_impl_kde.cc

Issue 10667026: Start consolidating cross-port file selection code into ui/base/dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Attempt to fix win Created 8 years, 5 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
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 <set> 5 #include <set>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/nix/mime_util_xdg.h" 11 #include "base/nix/mime_util_xdg.h"
12 #include "base/nix/xdg_util.h" 12 #include "base/nix/xdg_util.h"
13 #include "base/process_util.h" 13 #include "base/process_util.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/threading/thread_restrictions.h" 16 #include "base/threading/thread_restrictions.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "chrome/browser/ui/gtk/select_file_dialog_impl.h" 18 #include "chrome/browser/ui/gtk/select_file_dialog_impl.h"
19
20 // TODO(erg): Move all of this into WorkerPool.
19 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
20 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
21 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
22 24
23 // These conflict with base/tracked_objects.h, so need to come last. 25 // These conflict with base/tracked_objects.h, so need to come last.
24 #include <gdk/gdkx.h> 26 #include <gdk/gdkx.h>
25 #include <gtk/gtk.h> 27 #include <gtk/gtk.h>
26 28
27 using content::BrowserThread; 29 using content::BrowserThread;
28 30
29 namespace { 31 namespace {
30 32
31 std::string GetTitle(const std::string& title, int message_id) { 33 std::string GetTitle(const std::string& title, int message_id) {
32 return title.empty() ? l10n_util::GetStringUTF8(message_id) : title; 34 return title.empty() ? l10n_util::GetStringUTF8(message_id) : title;
33 } 35 }
34 36
35 const char kKdialogBinary[] = "kdialog"; 37 const char kKdialogBinary[] = "kdialog";
36 38
37 } // namespace 39 } // namespace
38 40
39 // Implementation of SelectFileDialog that shows a KDE common dialog for 41 // Implementation of SelectFileDialog that shows a KDE common dialog for
40 // choosing a file or folder. This acts as a modal dialog. 42 // choosing a file or folder. This acts as a modal dialog.
41 class SelectFileDialogImplKDE : public SelectFileDialogImpl { 43 class SelectFileDialogImplKDE : public SelectFileDialogImpl {
42 public: 44 public:
43 SelectFileDialogImplKDE(Listener* listener, 45 SelectFileDialogImplKDE(Listener* listener,
46 ui::SelectFilePolicy* policy,
44 base::nix::DesktopEnvironment desktop); 47 base::nix::DesktopEnvironment desktop);
45 48
46 protected: 49 protected:
47 virtual ~SelectFileDialogImplKDE(); 50 virtual ~SelectFileDialogImplKDE();
48 51
49 // SelectFileDialog implementation. 52 // SelectFileDialog implementation.
50 // |params| is user data we pass back via the Listener interface. 53 // |params| is user data we pass back via the Listener interface.
51 virtual void SelectFileImpl(Type type, 54 virtual void SelectFileImpl(Type type,
52 const string16& title, 55 const string16& title,
53 const FilePath& default_path, 56 const FilePath& default_path,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 CommandLine::StringVector cmd_vector; 152 CommandLine::StringVector cmd_vector;
150 cmd_vector.push_back(kKdialogBinary); 153 cmd_vector.push_back(kKdialogBinary);
151 cmd_vector.push_back("--version"); 154 cmd_vector.push_back("--version");
152 CommandLine command_line(cmd_vector); 155 CommandLine command_line(cmd_vector);
153 std::string dummy; 156 std::string dummy;
154 return base::GetAppOutput(command_line, &dummy); 157 return base::GetAppOutput(command_line, &dummy);
155 } 158 }
156 159
157 // static 160 // static
158 SelectFileDialogImpl* SelectFileDialogImpl::NewSelectFileDialogImplKDE( 161 SelectFileDialogImpl* SelectFileDialogImpl::NewSelectFileDialogImplKDE(
159 Listener* listener, base::nix::DesktopEnvironment desktop) { 162 Listener* listener,
160 return new SelectFileDialogImplKDE(listener, desktop); 163 ui::SelectFilePolicy* policy,
164 base::nix::DesktopEnvironment desktop) {
165 return new SelectFileDialogImplKDE(listener, policy, desktop);
161 } 166 }
162 167
163 SelectFileDialogImplKDE::SelectFileDialogImplKDE( 168 SelectFileDialogImplKDE::SelectFileDialogImplKDE(
164 Listener* listener, 169 Listener* listener,
170 ui::SelectFilePolicy* policy,
165 base::nix::DesktopEnvironment desktop) 171 base::nix::DesktopEnvironment desktop)
166 : SelectFileDialogImpl(listener), 172 : SelectFileDialogImpl(listener, policy),
167 desktop_(desktop) { 173 desktop_(desktop) {
168 DCHECK(desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE3 || 174 DCHECK(desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE3 ||
169 desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE4); 175 desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE4);
170 } 176 }
171 177
172 SelectFileDialogImplKDE::~SelectFileDialogImplKDE() { 178 SelectFileDialogImplKDE::~SelectFileDialogImplKDE() {
173 } 179 }
174 180
175 // We ignore |default_extension|. 181 // We ignore |default_extension|.
176 void SelectFileDialogImplKDE::SelectFileImpl( 182 void SelectFileDialogImplKDE::SelectFileImpl(
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 continue; 458 continue;
453 filenames_fp.push_back(path); 459 filenames_fp.push_back(path);
454 } 460 }
455 461
456 if (filenames_fp.empty()) { 462 if (filenames_fp.empty()) {
457 FileNotSelected(params); 463 FileNotSelected(params);
458 return; 464 return;
459 } 465 }
460 MultiFilesSelected(filenames_fp, params); 466 MultiFilesSelected(filenames_fp, params);
461 } 467 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/select_file_dialog_impl_gtk.cc ('k') | chrome/browser/ui/select_file_dialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698