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

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

Issue 8524019: Linux: Use --embed for dialogs on KDE3; Clean up dialogs_kde.cc. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | « chrome/browser/ui/gtk/dialogs_common.h ('k') | chrome/browser/ui/gtk/dialogs_kde.cc » ('j') | 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) 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 // This file implements commond select dialog functionality between GTK and KDE. 5 // This file implements commond select dialog functionality between GTK and KDE.
6 6
7 #include "chrome/browser/ui/gtk/dialogs_common.h" 7 #include "chrome/browser/ui/gtk/dialogs_common.h"
8 8
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/message_loop.h"
12 #include "base/nix/xdg_util.h" 11 #include "base/nix/xdg_util.h"
13 #include "base/threading/thread.h"
14 #include "base/threading/thread_restrictions.h" 12 #include "base/threading/thread_restrictions.h"
15 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
16 14
17 using content::BrowserThread; 15 using content::BrowserThread;
18 16
19 FilePath* SelectFileDialogImpl::last_saved_path_ = NULL; 17 FilePath* SelectFileDialogImpl::last_saved_path_ = NULL;
20 FilePath* SelectFileDialogImpl::last_opened_path_ = NULL; 18 FilePath* SelectFileDialogImpl::last_opened_path_ = NULL;
21 19
22 // static 20 // static
23 SelectFileDialog* SelectFileDialog::Create(Listener* listener) { 21 SelectFileDialog* SelectFileDialog::Create(Listener* listener) {
24 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 22 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
25 scoped_ptr<base::Environment> env(base::Environment::Create()); 23 scoped_ptr<base::Environment> env(base::Environment::Create());
26 base::nix::DesktopEnvironment desktop = 24 base::nix::DesktopEnvironment desktop =
27 base::nix::GetDesktopEnvironment(env.get()); 25 base::nix::GetDesktopEnvironment(env.get());
28 if (desktop == base::nix::DESKTOP_ENVIRONMENT_KDE3 || 26 if (desktop == base::nix::DESKTOP_ENVIRONMENT_KDE3 ||
29 desktop == base::nix::DESKTOP_ENVIRONMENT_KDE4) { 27 desktop == base::nix::DESKTOP_ENVIRONMENT_KDE4) {
30 return SelectFileDialogImpl::NewSelectFileDialogImplKDE(listener); 28 return SelectFileDialogImpl::NewSelectFileDialogImplKDE(listener, desktop);
31 } 29 }
32 return SelectFileDialogImpl::NewSelectFileDialogImplGTK(listener); 30 return SelectFileDialogImpl::NewSelectFileDialogImplGTK(listener);
33 } 31 }
34 32
35 SelectFileDialogImpl::SelectFileDialogImpl(Listener* listener) 33 SelectFileDialogImpl::SelectFileDialogImpl(Listener* listener)
36 : SelectFileDialog(listener), 34 : SelectFileDialog(listener),
37 file_type_index_(0), 35 file_type_index_(0),
38 type_(SELECT_NONE) { 36 type_(SELECT_NONE) {
39 if (!last_saved_path_) { 37 if (!last_saved_path_) {
40 last_saved_path_ = new FilePath(); 38 last_saved_path_ = new FilePath();
41 last_opened_path_ = new FilePath(); 39 last_opened_path_ = new FilePath();
42 } 40 }
43 } 41 }
44 42
45 SelectFileDialogImpl::~SelectFileDialogImpl() { } 43 SelectFileDialogImpl::~SelectFileDialogImpl() { }
46 44
47 void SelectFileDialogImpl::ListenerDestroyed() { 45 void SelectFileDialogImpl::ListenerDestroyed() {
48 listener_ = NULL; 46 listener_ = NULL;
49 } 47 }
50 48
51 bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow parent_window) const { 49 bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow parent_window) const {
52 return parents_.find(parent_window) != parents_.end(); 50 return parents_.find(parent_window) != parents_.end();
53 } 51 }
54 52
55 bool SelectFileDialogImpl::CallDirectoryExistsOnUIThread(const FilePath& path) { 53 bool SelectFileDialogImpl::CallDirectoryExistsOnUIThread(const FilePath& path) {
56 base::ThreadRestrictions::ScopedAllowIO allow_io; 54 base::ThreadRestrictions::ScopedAllowIO allow_io;
57 return file_util::DirectoryExists(path); 55 return file_util::DirectoryExists(path);
58 } 56 }
59
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/dialogs_common.h ('k') | chrome/browser/ui/gtk/dialogs_kde.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698