summaryrefslogtreecommitdiffstats
path: root/chromium/ui/shell_dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/shell_dialogs')
-rw-r--r--chromium/ui/shell_dialogs/DEPS1
-rw-r--r--chromium/ui/shell_dialogs/base_shell_dialog_win.cc4
-rw-r--r--chromium/ui/shell_dialogs/gtk/OWNERS2
-rw-r--r--chromium/ui/shell_dialogs/gtk/select_file_dialog_impl.cc92
-rw-r--r--chromium/ui/shell_dialogs/gtk/select_file_dialog_impl.h89
-rw-r--r--chromium/ui/shell_dialogs/gtk/select_file_dialog_impl_gtk.cc596
-rw-r--r--chromium/ui/shell_dialogs/gtk/select_file_dialog_impl_kde.cc485
-rw-r--r--chromium/ui/shell_dialogs/print_settings_dialog_win.cc58
-rw-r--r--chromium/ui/shell_dialogs/print_settings_dialog_win.h83
-rw-r--r--chromium/ui/shell_dialogs/select_file_dialog.cc13
-rw-r--r--chromium/ui/shell_dialogs/select_file_dialog_android.cc9
-rw-r--r--chromium/ui/shell_dialogs/select_file_dialog_android.h3
-rw-r--r--chromium/ui/shell_dialogs/select_file_dialog_win.cc74
-rw-r--r--chromium/ui/shell_dialogs/shell_dialogs.gyp33
14 files changed, 67 insertions, 1475 deletions
diff --git a/chromium/ui/shell_dialogs/DEPS b/chromium/ui/shell_dialogs/DEPS
index acb8514c82d..9d4f4134342 100644
--- a/chromium/ui/shell_dialogs/DEPS
+++ b/chromium/ui/shell_dialogs/DEPS
@@ -4,4 +4,5 @@ include_rules = [
"+ui/aura",
"+ui/base",
"+ui/gfx",
+ "+win8/viewer",
]
diff --git a/chromium/ui/shell_dialogs/base_shell_dialog_win.cc b/chromium/ui/shell_dialogs/base_shell_dialog_win.cc
index e121fbfbd16..9ccd1bbc456 100644
--- a/chromium/ui/shell_dialogs/base_shell_dialog_win.cc
+++ b/chromium/ui/shell_dialogs/base_shell_dialog_win.cc
@@ -30,9 +30,7 @@ BaseShellDialogImpl::RunState BaseShellDialogImpl::BeginRun(HWND owner) {
DCHECK(!IsRunningDialogForOwner(owner));
// The owner must be a top level window, otherwise we could end up with two
// entries in our map for the same top level window.
- // TODO(scottmg): This should be re-enabled when Chrome Frame is removed.
- // http://crbug.com/310264
- // DCHECK(!owner || owner == GetAncestor(owner, GA_ROOT));
+ DCHECK(!owner || owner == GetAncestor(owner, GA_ROOT));
RunState run_state;
run_state.dialog_thread = CreateDialogThread();
run_state.owner = owner;
diff --git a/chromium/ui/shell_dialogs/gtk/OWNERS b/chromium/ui/shell_dialogs/gtk/OWNERS
deleted file mode 100644
index 0573e6b64cb..00000000000
--- a/chromium/ui/shell_dialogs/gtk/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-erg@chromium.org
-estade@chromium.org
diff --git a/chromium/ui/shell_dialogs/gtk/select_file_dialog_impl.cc b/chromium/ui/shell_dialogs/gtk/select_file_dialog_impl.cc
deleted file mode 100644
index c7e80c1a38c..00000000000
--- a/chromium/ui/shell_dialogs/gtk/select_file_dialog_impl.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// This file implements common select dialog functionality between GTK and KDE.
-
-#include "ui/shell_dialogs/gtk/select_file_dialog_impl.h"
-
-#include "base/environment.h"
-#include "base/file_util.h"
-#include "base/nix/xdg_util.h"
-#include "base/threading/thread_restrictions.h"
-
-namespace {
-
-enum UseKdeFileDialogStatus {
- UNKNOWN,
- NO_KDE,
- YES_KDE
-};
-
-UseKdeFileDialogStatus use_kde_ = UNKNOWN;
-
-} // namespace
-
-namespace ui {
-
-base::FilePath* SelectFileDialogImpl::last_saved_path_ = NULL;
-base::FilePath* SelectFileDialogImpl::last_opened_path_ = NULL;
-
-// static
-SelectFileDialog* CreateLinuxSelectFileDialog(
- SelectFileDialog::Listener* listener,
- SelectFilePolicy* policy) {
- if (use_kde_ == UNKNOWN) {
- // Start out assumimg we are not going to use KDE.
- use_kde_ = NO_KDE;
-
- // Check to see if KDE is the desktop environment.
- scoped_ptr<base::Environment> env(base::Environment::Create());
- base::nix::DesktopEnvironment desktop =
- base::nix::GetDesktopEnvironment(env.get());
- if (desktop == base::nix::DESKTOP_ENVIRONMENT_KDE3 ||
- desktop == base::nix::DESKTOP_ENVIRONMENT_KDE4) {
- // Check to see if the user dislikes the KDE file dialog.
- if (!env->HasVar("NO_CHROME_KDE_FILE_DIALOG")) {
- // Check to see if the KDE dialog works.
- if (SelectFileDialogImpl::CheckKDEDialogWorksOnUIThread()) {
- use_kde_ = YES_KDE;
- }
- }
- }
- }
-
- if (use_kde_ == NO_KDE)
- return SelectFileDialogImpl::NewSelectFileDialogImplGTK(listener, policy);
-
- scoped_ptr<base::Environment> env(base::Environment::Create());
- base::nix::DesktopEnvironment desktop =
- base::nix::GetDesktopEnvironment(env.get());
- return SelectFileDialogImpl::NewSelectFileDialogImplKDE(
- listener, policy, desktop);
-}
-
-SelectFileDialogImpl::SelectFileDialogImpl(Listener* listener,
- ui::SelectFilePolicy* policy)
- : SelectFileDialog(listener, policy),
- file_type_index_(0),
- type_(SELECT_NONE) {
- if (!last_saved_path_) {
- last_saved_path_ = new base::FilePath();
- last_opened_path_ = new base::FilePath();
- }
-}
-
-SelectFileDialogImpl::~SelectFileDialogImpl() { }
-
-void SelectFileDialogImpl::ListenerDestroyed() {
- listener_ = NULL;
-}
-
-bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow parent_window) const {
- return parents_.find(parent_window) != parents_.end();
-}
-
-bool SelectFileDialogImpl::CallDirectoryExistsOnUIThread(
- const base::FilePath& path) {
- base::ThreadRestrictions::ScopedAllowIO allow_io;
- return base::DirectoryExists(path);
-}
-
-} // namespace ui
diff --git a/chromium/ui/shell_dialogs/gtk/select_file_dialog_impl.h b/chromium/ui/shell_dialogs/gtk/select_file_dialog_impl.h
deleted file mode 100644
index ebe497fb6f6..00000000000
--- a/chromium/ui/shell_dialogs/gtk/select_file_dialog_impl.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// This file implements common select dialog functionality between GTK and KDE.
-
-#ifndef UI_SHELL_DIALOGS_GTK_SELECT_FILE_DIALOG_IMPL_H_
-#define UI_SHELL_DIALOGS_GTK_SELECT_FILE_DIALOG_IMPL_H_
-
-#include <set>
-
-#include "base/compiler_specific.h"
-#include "base/nix/xdg_util.h"
-#include "ui/shell_dialogs/select_file_dialog.h"
-
-namespace ui {
-
-// Shared implementation SelectFileDialog used by SelectFileDialogImplGTK
-class SelectFileDialogImpl : public SelectFileDialog {
- public:
- // Factory method for creating a GTK-styled SelectFileDialogImpl
- static SelectFileDialogImpl* NewSelectFileDialogImplGTK(
- Listener* listener,
- ui::SelectFilePolicy* policy);
- // Factory method for creating a KDE-styled SelectFileDialogImpl
- static SelectFileDialogImpl* NewSelectFileDialogImplKDE(
- Listener* listener,
- ui::SelectFilePolicy* policy,
- base::nix::DesktopEnvironment desktop);
-
- // Returns true if the SelectFileDialog class returned by
- // NewSelectFileDialogImplKDE will actually work.
- static bool CheckKDEDialogWorksOnUIThread();
-
- // BaseShellDialog implementation.
- virtual bool IsRunning(gfx::NativeWindow parent_window) const OVERRIDE;
- virtual void ListenerDestroyed() OVERRIDE;
-
- protected:
- explicit SelectFileDialogImpl(Listener* listener,
- ui::SelectFilePolicy* policy);
- virtual ~SelectFileDialogImpl();
-
- // SelectFileDialog implementation.
- // |params| is user data we pass back via the Listener interface.
- virtual void SelectFileImpl(
- Type type,
- const base::string16& title,
- const base::FilePath& default_path,
- const FileTypeInfo* file_types,
- int file_type_index,
- const base::FilePath::StringType& default_extension,
- gfx::NativeWindow owning_window,
- void* params) = 0;
-
- // Wrapper for base::DirectoryExists() that allow access on the UI
- // thread. Use this only in the file dialog functions, where it's ok
- // because the file dialog has to do many stats anyway. One more won't
- // hurt too badly and it's likely already cached.
- bool CallDirectoryExistsOnUIThread(const base::FilePath& path);
-
- // The file filters.
- FileTypeInfo file_types_;
-
- // The index of the default selected file filter.
- // Note: This starts from 1, not 0.
- size_t file_type_index_;
-
- // The set of all parent windows for which we are currently running dialogs.
- std::set<GtkWindow*> parents_;
-
- // The type of dialog we are showing the user.
- Type type_;
-
- // These two variables track where the user last saved a file or opened a
- // file so that we can display future dialogs with the same starting path.
- static base::FilePath* last_saved_path_;
- static base::FilePath* last_opened_path_;
-
- DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl);
-};
-
-SelectFileDialog* CreateLinuxSelectFileDialog(
- SelectFileDialog::Listener* listener,
- SelectFilePolicy* policy);
-
-} // namespace ui
-
-#endif // UI_SHELL_DIALOGS_GTK_SELECT_FILE_DIALOG_IMPL_H_
diff --git a/chromium/ui/shell_dialogs/gtk/select_file_dialog_impl_gtk.cc b/chromium/ui/shell_dialogs/gtk/select_file_dialog_impl_gtk.cc
deleted file mode 100644
index ecb97dcd794..00000000000
--- a/chromium/ui/shell_dialogs/gtk/select_file_dialog_impl_gtk.cc
+++ /dev/null
@@ -1,596 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <gtk/gtk.h>
-#include <map>
-#include <set>
-#include <vector>
-
-#include "base/file_util.h"
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
-#include "base/strings/string_util.h"
-#include "base/strings/sys_string_conversions.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/threading/thread.h"
-#include "base/threading/thread_restrictions.h"
-#include "grit/ui_strings.h"
-#include "ui/base/gtk/gtk_signal.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/shell_dialogs/gtk/select_file_dialog_impl.h"
-#include "ui/shell_dialogs/select_file_dialog.h"
-
-namespace {
-
-// Makes sure that .jpg also shows .JPG.
-gboolean FileFilterCaseInsensitive(const GtkFileFilterInfo* file_info,
- std::string* file_extension) {
- return EndsWith(file_info->filename, *file_extension, false);
-}
-
-// Deletes |data| when gtk_file_filter_add_custom() is done with it.
-void OnFileFilterDataDestroyed(std::string* file_extension) {
- delete file_extension;
-}
-
-// Implementation of SelectFileDialog that shows a Gtk common dialog for
-// choosing a file or folder. This acts as a modal dialog.
-class SelectFileDialogImplGTK : public ui::SelectFileDialogImpl {
- public:
- explicit SelectFileDialogImplGTK(Listener* listener,
- ui::SelectFilePolicy* policy);
-
- protected:
- virtual ~SelectFileDialogImplGTK();
-
- // SelectFileDialog implementation.
- // |params| is user data we pass back via the Listener interface.
- virtual void SelectFileImpl(
- Type type,
- const base::string16& title,
- const base::FilePath& default_path,
- const FileTypeInfo* file_types,
- int file_type_index,
- const base::FilePath::StringType& default_extension,
- gfx::NativeWindow owning_window,
- void* params) OVERRIDE;
-
- private:
- virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE;
-
- // Add the filters from |file_types_| to |chooser|.
- void AddFilters(GtkFileChooser* chooser);
-
- // Notifies the listener that a single file was chosen.
- void FileSelected(GtkWidget* dialog, const base::FilePath& path);
-
- // Notifies the listener that multiple files were chosen.
- void MultiFilesSelected(GtkWidget* dialog,
- const std::vector<base::FilePath>& files);
-
- // Notifies the listener that no file was chosen (the action was canceled).
- // Dialog is passed so we can find that |params| pointer that was passed to
- // us when we were told to show the dialog.
- void FileNotSelected(GtkWidget* dialog);
-
- GtkWidget* CreateSelectFolderDialog(
- Type type,
- const std::string& title,
- const base::FilePath& default_path,
- gfx::NativeWindow parent);
-
- GtkWidget* CreateFileOpenDialog(const std::string& title,
- const base::FilePath& default_path, gfx::NativeWindow parent);
-
- GtkWidget* CreateMultiFileOpenDialog(const std::string& title,
- const base::FilePath& default_path, gfx::NativeWindow parent);
-
- GtkWidget* CreateSaveAsDialog(const std::string& title,
- const base::FilePath& default_path, gfx::NativeWindow parent);
-
- // Removes and returns the |params| associated with |dialog| from
- // |params_map_|.
- void* PopParamsForDialog(GtkWidget* dialog);
-
- // Take care of internal data structures when a file dialog is destroyed.
- void FileDialogDestroyed(GtkWidget* dialog);
-
- // Check whether response_id corresponds to the user cancelling/closing the
- // dialog. Used as a helper for the below callbacks.
- bool IsCancelResponse(gint response_id);
-
- // Common function for OnSelectSingleFileDialogResponse and
- // OnSelectSingleFolderDialogResponse.
- void SelectSingleFileHelper(GtkWidget* dialog,
- gint response_id,
- bool allow_folder);
-
- // Common function for CreateFileOpenDialog and CreateMultiFileOpenDialog.
- GtkWidget* CreateFileOpenHelper(const std::string& title,
- const base::FilePath& default_path,
- gfx::NativeWindow parent);
-
- // Callback for when the user responds to a Save As or Open File dialog.
- CHROMEGTK_CALLBACK_1(SelectFileDialogImplGTK, void,
- OnSelectSingleFileDialogResponse, int);
-
- // Callback for when the user responds to a Select Folder dialog.
- CHROMEGTK_CALLBACK_1(SelectFileDialogImplGTK, void,
- OnSelectSingleFolderDialogResponse, int);
-
- // Callback for when the user responds to a Open Multiple Files dialog.
- CHROMEGTK_CALLBACK_1(SelectFileDialogImplGTK, void,
- OnSelectMultiFileDialogResponse, int);
-
- // Callback for when the file chooser gets destroyed.
- CHROMEGTK_CALLBACK_0(SelectFileDialogImplGTK, void, OnFileChooserDestroy);
-
- // Callback for when we update the preview for the selection.
- CHROMEGTK_CALLBACK_0(SelectFileDialogImplGTK, void, OnUpdatePreview);
-
- // A map from dialog windows to the |params| user data associated with them.
- std::map<GtkWidget*, void*> params_map_;
-
- // The GtkImage widget for showing previews of selected images.
- GtkWidget* preview_;
-
- // All our dialogs.
- std::set<GtkWidget*> dialogs_;
-
- DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImplGTK);
-};
-
-// The size of the preview we display for selected image files. We set height
-// larger than width because generally there is more free space vertically
-// than horiztonally (setting the preview image will alway expand the width of
-// the dialog, but usually not the height). The image's aspect ratio will always
-// be preserved.
-static const int kPreviewWidth = 256;
-static const int kPreviewHeight = 512;
-
-SelectFileDialogImplGTK::SelectFileDialogImplGTK(Listener* listener,
- ui::SelectFilePolicy* policy)
- : SelectFileDialogImpl(listener, policy),
- preview_(NULL) {
-}
-
-SelectFileDialogImplGTK::~SelectFileDialogImplGTK() {
- while (dialogs_.begin() != dialogs_.end()) {
- gtk_widget_destroy(*(dialogs_.begin()));
- }
-}
-
-bool SelectFileDialogImplGTK::HasMultipleFileTypeChoicesImpl() {
- return file_types_.extensions.size() > 1;
-}
-
-// We ignore |default_extension|.
-void SelectFileDialogImplGTK::SelectFileImpl(
- Type type,
- const base::string16& title,
- const base::FilePath& default_path,
- const FileTypeInfo* file_types,
- int file_type_index,
- const base::FilePath::StringType& default_extension,
- gfx::NativeWindow owning_window,
- void* params) {
- type_ = type;
- // |owning_window| can be null when user right-clicks on a downloadable item
- // and chooses 'Open Link in New Tab' when 'Ask where to save each file
- // before downloading.' preference is turned on. (http://crbug.com/29213)
- if (owning_window)
- parents_.insert(owning_window);
-
- std::string title_string = UTF16ToUTF8(title);
-
- file_type_index_ = file_type_index;
- if (file_types)
- file_types_ = *file_types;
- else
- file_types_.include_all_files = true;
-
- GtkWidget* dialog = NULL;
- switch (type) {
- case SELECT_FOLDER:
- case SELECT_UPLOAD_FOLDER:
- dialog = CreateSelectFolderDialog(type, title_string, default_path,
- owning_window);
- break;
- case SELECT_OPEN_FILE:
- dialog = CreateFileOpenDialog(title_string, default_path, owning_window);
- break;
- case SELECT_OPEN_MULTI_FILE:
- dialog = CreateMultiFileOpenDialog(title_string, default_path,
- owning_window);
- break;
- case SELECT_SAVEAS_FILE:
- dialog = CreateSaveAsDialog(title_string, default_path, owning_window);
- break;
- default:
- NOTREACHED();
- return;
- }
- g_signal_connect(dialog, "delete-event",
- G_CALLBACK(gtk_widget_hide_on_delete), NULL);
- dialogs_.insert(dialog);
-
- preview_ = gtk_image_new();
- g_signal_connect(dialog, "destroy",
- G_CALLBACK(OnFileChooserDestroyThunk), this);
- g_signal_connect(dialog, "update-preview",
- G_CALLBACK(OnUpdatePreviewThunk), this);
- gtk_file_chooser_set_preview_widget(GTK_FILE_CHOOSER(dialog), preview_);
-
- params_map_[dialog] = params;
-
- // Set window-to-parent modality by adding the dialog to the same window
- // group as the parent.
- gtk_window_group_add_window(gtk_window_get_group(owning_window),
- GTK_WINDOW(dialog));
- gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
-
- gtk_widget_show_all(dialog);
-}
-
-void SelectFileDialogImplGTK::AddFilters(GtkFileChooser* chooser) {
- for (size_t i = 0; i < file_types_.extensions.size(); ++i) {
- GtkFileFilter* filter = NULL;
- std::set<std::string> fallback_labels;
-
- for (size_t j = 0; j < file_types_.extensions[i].size(); ++j) {
- const std::string& current_extension = file_types_.extensions[i][j];
- if (!current_extension.empty()) {
- if (!filter)
- filter = gtk_file_filter_new();
- scoped_ptr<std::string> file_extension(
- new std::string("." + current_extension));
- fallback_labels.insert(std::string("*").append(*file_extension));
- gtk_file_filter_add_custom(
- filter,
- GTK_FILE_FILTER_FILENAME,
- reinterpret_cast<GtkFileFilterFunc>(FileFilterCaseInsensitive),
- file_extension.release(),
- reinterpret_cast<GDestroyNotify>(OnFileFilterDataDestroyed));
- }
- }
- // We didn't find any non-empty extensions to filter on.
- if (!filter)
- continue;
-
- // The description vector may be blank, in which case we are supposed to
- // use some sort of default description based on the filter.
- if (i < file_types_.extension_description_overrides.size()) {
- gtk_file_filter_set_name(filter, UTF16ToUTF8(
- file_types_.extension_description_overrides[i]).c_str());
- } else {
- // There is no system default filter description so we use
- // the extensions themselves if the description is blank.
- std::vector<std::string> fallback_labels_vector(fallback_labels.begin(),
- fallback_labels.end());
- std::string fallback_label = JoinString(fallback_labels_vector, ',');
- gtk_file_filter_set_name(filter, fallback_label.c_str());
- }
-
- gtk_file_chooser_add_filter(chooser, filter);
- if (i == file_type_index_ - 1)
- gtk_file_chooser_set_filter(chooser, filter);
- }
-
- // Add the *.* filter, but only if we have added other filters (otherwise it
- // is implied).
- if (file_types_.include_all_files && !file_types_.extensions.empty()) {
- GtkFileFilter* filter = gtk_file_filter_new();
- gtk_file_filter_add_pattern(filter, "*");
- gtk_file_filter_set_name(filter,
- l10n_util::GetStringUTF8(IDS_SAVEAS_ALL_FILES).c_str());
- gtk_file_chooser_add_filter(chooser, filter);
- }
-}
-
-void SelectFileDialogImplGTK::FileSelected(GtkWidget* dialog,
- const base::FilePath& path) {
- if (type_ == SELECT_SAVEAS_FILE) {
- *last_saved_path_ = path.DirName();
- } else if (type_ == SELECT_OPEN_FILE || type_ == SELECT_FOLDER ||
- type_ == SELECT_UPLOAD_FOLDER) {
- *last_opened_path_ = path.DirName();
- } else {
- NOTREACHED();
- }
-
- if (listener_) {
- GtkFileFilter* selected_filter =
- gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(dialog));
- GSList* filters = gtk_file_chooser_list_filters(GTK_FILE_CHOOSER(dialog));
- int idx = g_slist_index(filters, selected_filter);
- g_slist_free(filters);
- listener_->FileSelected(path, idx + 1, PopParamsForDialog(dialog));
- }
- gtk_widget_destroy(dialog);
-}
-
-void SelectFileDialogImplGTK::MultiFilesSelected(GtkWidget* dialog,
- const std::vector<base::FilePath>& files) {
- *last_opened_path_ = files[0].DirName();
-
- if (listener_)
- listener_->MultiFilesSelected(files, PopParamsForDialog(dialog));
- gtk_widget_destroy(dialog);
-}
-
-void SelectFileDialogImplGTK::FileNotSelected(GtkWidget* dialog) {
- void* params = PopParamsForDialog(dialog);
- if (listener_)
- listener_->FileSelectionCanceled(params);
- gtk_widget_destroy(dialog);
-}
-
-GtkWidget* SelectFileDialogImplGTK::CreateFileOpenHelper(
- const std::string& title,
- const base::FilePath& default_path,
- gfx::NativeWindow parent) {
- GtkWidget* dialog =
- gtk_file_chooser_dialog_new(title.c_str(), parent,
- GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
- NULL);
- AddFilters(GTK_FILE_CHOOSER(dialog));
-
- if (!default_path.empty()) {
- if (CallDirectoryExistsOnUIThread(default_path)) {
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
- default_path.value().c_str());
- } else {
- // If the file doesn't exist, this will just switch to the correct
- // directory. That's good enough.
- gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),
- default_path.value().c_str());
- }
- } else if (!last_opened_path_->empty()) {
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
- last_opened_path_->value().c_str());
- }
- return dialog;
-}
-
-GtkWidget* SelectFileDialogImplGTK::CreateSelectFolderDialog(
- Type type,
- const std::string& title,
- const base::FilePath& default_path,
- gfx::NativeWindow parent) {
- std::string title_string = title;
- if (title_string.empty()) {
- title_string = (type == SELECT_UPLOAD_FOLDER) ?
- l10n_util::GetStringUTF8(IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE) :
- l10n_util::GetStringUTF8(IDS_SELECT_FOLDER_DIALOG_TITLE);
- }
- std::string accept_button_label = (type == SELECT_UPLOAD_FOLDER) ?
- l10n_util::GetStringUTF8(IDS_SELECT_UPLOAD_FOLDER_DIALOG_UPLOAD_BUTTON) :
- GTK_STOCK_OPEN;
-
- GtkWidget* dialog =
- gtk_file_chooser_dialog_new(title_string.c_str(), parent,
- GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- accept_button_label.c_str(),
- GTK_RESPONSE_ACCEPT,
- NULL);
-
- if (!default_path.empty()) {
- gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),
- default_path.value().c_str());
- } else if (!last_opened_path_->empty()) {
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
- last_opened_path_->value().c_str());
- }
- gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
- g_signal_connect(dialog, "response",
- G_CALLBACK(OnSelectSingleFolderDialogResponseThunk), this);
- return dialog;
-}
-
-GtkWidget* SelectFileDialogImplGTK::CreateFileOpenDialog(
- const std::string& title,
- const base::FilePath& default_path,
- gfx::NativeWindow parent) {
- std::string title_string = !title.empty() ? title :
- l10n_util::GetStringUTF8(IDS_OPEN_FILE_DIALOG_TITLE);
-
- GtkWidget* dialog = CreateFileOpenHelper(title_string, default_path, parent);
- gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
- g_signal_connect(dialog, "response",
- G_CALLBACK(OnSelectSingleFileDialogResponseThunk), this);
- return dialog;
-}
-
-GtkWidget* SelectFileDialogImplGTK::CreateMultiFileOpenDialog(
- const std::string& title,
- const base::FilePath& default_path,
- gfx::NativeWindow parent) {
- std::string title_string = !title.empty() ? title :
- l10n_util::GetStringUTF8(IDS_OPEN_FILES_DIALOG_TITLE);
-
- GtkWidget* dialog = CreateFileOpenHelper(title_string, default_path, parent);
- gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE);
- g_signal_connect(dialog, "response",
- G_CALLBACK(OnSelectMultiFileDialogResponseThunk), this);
- return dialog;
-}
-
-GtkWidget* SelectFileDialogImplGTK::CreateSaveAsDialog(const std::string& title,
- const base::FilePath& default_path, gfx::NativeWindow parent) {
- std::string title_string = !title.empty() ? title :
- l10n_util::GetStringUTF8(IDS_SAVE_AS_DIALOG_TITLE);
-
- GtkWidget* dialog =
- gtk_file_chooser_dialog_new(title_string.c_str(), parent,
- GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
- NULL);
-
- AddFilters(GTK_FILE_CHOOSER(dialog));
- if (!default_path.empty()) {
- // Since the file may not already exist, we use
- // set_current_folder() followed by set_current_name(), as per the
- // recommendation of the GTK docs.
- if (CallDirectoryExistsOnUIThread(default_path)) {
- gtk_file_chooser_set_current_folder(
- GTK_FILE_CHOOSER(dialog), default_path.value().c_str());
- gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), "");
- } else {
- gtk_file_chooser_set_current_folder(
- GTK_FILE_CHOOSER(dialog), default_path.DirName().value().c_str());
- gtk_file_chooser_set_current_name(
- GTK_FILE_CHOOSER(dialog), default_path.BaseName().value().c_str());
- }
- } else if (!last_saved_path_->empty()) {
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
- last_saved_path_->value().c_str());
- }
- gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
- gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog),
- TRUE);
- g_signal_connect(dialog, "response",
- G_CALLBACK(OnSelectSingleFileDialogResponseThunk), this);
- return dialog;
-}
-
-void* SelectFileDialogImplGTK::PopParamsForDialog(GtkWidget* dialog) {
- std::map<GtkWidget*, void*>::iterator iter = params_map_.find(dialog);
- DCHECK(iter != params_map_.end());
- void* params = iter->second;
- params_map_.erase(iter);
- return params;
-}
-
-void SelectFileDialogImplGTK::FileDialogDestroyed(GtkWidget* dialog) {
- dialogs_.erase(dialog);
-
- // Parent may be NULL in a few cases: 1) on shutdown when
- // AllBrowsersClosed() trigger this handler after all the browser
- // windows got destroyed, or 2) when the parent tab has been opened by
- // 'Open Link in New Tab' context menu on a downloadable item and
- // the tab has no content (see the comment in SelectFile as well).
- GtkWindow* parent = gtk_window_get_transient_for(GTK_WINDOW(dialog));
- if (!parent)
- return;
- std::set<GtkWindow*>::iterator iter = parents_.find(parent);
- if (iter != parents_.end())
- parents_.erase(iter);
- else
- NOTREACHED();
-}
-
-bool SelectFileDialogImplGTK::IsCancelResponse(gint response_id) {
- bool is_cancel = response_id == GTK_RESPONSE_CANCEL ||
- response_id == GTK_RESPONSE_DELETE_EVENT;
- if (is_cancel)
- return true;
-
- DCHECK(response_id == GTK_RESPONSE_ACCEPT);
- return false;
-}
-
-void SelectFileDialogImplGTK::SelectSingleFileHelper(GtkWidget* dialog,
- gint response_id,
- bool allow_folder) {
- if (IsCancelResponse(response_id)) {
- FileNotSelected(dialog);
- return;
- }
-
- gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
- if (!filename) {
- FileNotSelected(dialog);
- return;
- }
-
- base::FilePath path(filename);
- g_free(filename);
-
- if (allow_folder) {
- FileSelected(dialog, path);
- return;
- }
-
- if (CallDirectoryExistsOnUIThread(path))
- FileNotSelected(dialog);
- else
- FileSelected(dialog, path);
-}
-
-void SelectFileDialogImplGTK::OnSelectSingleFileDialogResponse(
- GtkWidget* dialog, int response_id) {
- SelectSingleFileHelper(dialog, response_id, false);
-}
-
-void SelectFileDialogImplGTK::OnSelectSingleFolderDialogResponse(
- GtkWidget* dialog, int response_id) {
- SelectSingleFileHelper(dialog, response_id, true);
-}
-
-void SelectFileDialogImplGTK::OnSelectMultiFileDialogResponse(GtkWidget* dialog,
- int response_id) {
- if (IsCancelResponse(response_id)) {
- FileNotSelected(dialog);
- return;
- }
-
- GSList* filenames = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
- if (!filenames) {
- FileNotSelected(dialog);
- return;
- }
-
- std::vector<base::FilePath> filenames_fp;
- for (GSList* iter = filenames; iter != NULL; iter = g_slist_next(iter)) {
- base::FilePath path(static_cast<char*>(iter->data));
- g_free(iter->data);
- if (CallDirectoryExistsOnUIThread(path))
- continue;
- filenames_fp.push_back(path);
- }
- g_slist_free(filenames);
-
- if (filenames_fp.empty()) {
- FileNotSelected(dialog);
- return;
- }
- MultiFilesSelected(dialog, filenames_fp);
-}
-
-void SelectFileDialogImplGTK::OnFileChooserDestroy(GtkWidget* dialog) {
- FileDialogDestroyed(dialog);
-}
-
-void SelectFileDialogImplGTK::OnUpdatePreview(GtkWidget* chooser) {
- gchar* filename = gtk_file_chooser_get_preview_filename(
- GTK_FILE_CHOOSER(chooser));
- if (!filename)
- return;
- // This will preserve the image's aspect ratio.
- GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth,
- kPreviewHeight, NULL);
- g_free(filename);
- if (pixbuf) {
- gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf);
- g_object_unref(pixbuf);
- }
- gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser),
- pixbuf ? TRUE : FALSE);
-}
-
-} // namespace
-
-namespace ui {
-
-SelectFileDialogImpl* SelectFileDialogImpl::NewSelectFileDialogImplGTK(
- Listener* listener, ui::SelectFilePolicy* policy) {
- return new SelectFileDialogImplGTK(listener, policy);
-}
-
-} // namespace ui
diff --git a/chromium/ui/shell_dialogs/gtk/select_file_dialog_impl_kde.cc b/chromium/ui/shell_dialogs/gtk/select_file_dialog_impl_kde.cc
deleted file mode 100644
index e41c327bc32..00000000000
--- a/chromium/ui/shell_dialogs/gtk/select_file_dialog_impl_kde.cc
+++ /dev/null
@@ -1,485 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <set>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/command_line.h"
-#include "base/logging.h"
-#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_loop_proxy.h"
-#include "base/nix/mime_util_xdg.h"
-#include "base/nix/xdg_util.h"
-#include "base/process/launch.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/threading/thread_restrictions.h"
-#include "base/threading/worker_pool.h"
-#include "grit/ui_strings.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/shell_dialogs/gtk/select_file_dialog_impl.h"
-
-// These conflict with base/tracked_objects.h, so need to come last.
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-
-namespace {
-
-std::string GetTitle(const std::string& title, int message_id) {
- return title.empty() ? l10n_util::GetStringUTF8(message_id) : title;
-}
-
-const char kKdialogBinary[] = "kdialog";
-
-// Implementation of SelectFileDialog that shows a KDE common dialog for
-// choosing a file or folder. This acts as a modal dialog.
-class SelectFileDialogImplKDE : public ui::SelectFileDialogImpl {
- public:
- SelectFileDialogImplKDE(Listener* listener,
- ui::SelectFilePolicy* policy,
- base::nix::DesktopEnvironment desktop);
-
- protected:
- virtual ~SelectFileDialogImplKDE();
-
- // SelectFileDialog implementation.
- // |params| is user data we pass back via the Listener interface.
- virtual void SelectFileImpl(
- Type type,
- const base::string16& title,
- const base::FilePath& default_path,
- const FileTypeInfo* file_types,
- int file_type_index,
- const base::FilePath::StringType& default_extension,
- gfx::NativeWindow owning_window,
- void* params) OVERRIDE;
-
- private:
- virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE;
-
- struct KDialogParams {
- // This constructor can only be run from the UI thread.
- KDialogParams(const std::string& type,
- const std::string& title,
- const base::FilePath& default_path,
- gfx::NativeWindow parent,
- bool file_operation,
- bool multiple_selection,
- void* kdialog_params,
- void(SelectFileDialogImplKDE::* callback)(const std::string&,
- int,
- void*))
- : type(type),
- title(title),
- default_path(default_path),
- parent(parent),
- file_operation(file_operation),
- multiple_selection(multiple_selection),
- kdialog_params(kdialog_params),
- ui_loop_proxy(
- base::MessageLoopForUI::current()->message_loop_proxy()),
- callback(callback) {}
-
- std::string type;
- std::string title;
- base::FilePath default_path;
- gfx::NativeWindow parent;
- bool file_operation;
- bool multiple_selection;
- void* kdialog_params;
- scoped_refptr<base::MessageLoopProxy> ui_loop_proxy;
-
- void (SelectFileDialogImplKDE::*callback)(const std::string&, int, void*);
- };
-
- // Get the filters from |file_types_| and concatenate them into
- // |filter_string|.
- std::string GetMimeTypeFilterString();
-
- // Get KDialog command line representing the Argv array for KDialog.
- void GetKDialogCommandLine(const std::string& type, const std::string& title,
- const base::FilePath& default_path, gfx::NativeWindow parent,
- bool file_operation, bool multiple_selection, CommandLine* command_line);
-
- // Call KDialog on a worker thread and post results back to the caller
- // thread.
- void CallKDialogOutput(const KDialogParams& params);
-
- // Notifies the listener that a single file was chosen.
- void FileSelected(const base::FilePath& path, void* params);
-
- // Notifies the listener that multiple files were chosen.
- void MultiFilesSelected(const std::vector<base::FilePath>& files,
- void* params);
-
- // Notifies the listener that no file was chosen (the action was canceled).
- // Dialog is passed so we can find that |params| pointer that was passed to
- // us when we were told to show the dialog.
- void FileNotSelected(void *params);
-
- void CreateSelectFolderDialog(Type type,
- const std::string& title,
- const base::FilePath& default_path,
- gfx::NativeWindow parent, void* params);
-
- void CreateFileOpenDialog(const std::string& title,
- const base::FilePath& default_path,
- gfx::NativeWindow parent, void* params);
-
- void CreateMultiFileOpenDialog(const std::string& title,
- const base::FilePath& default_path,
- gfx::NativeWindow parent, void* params);
-
- void CreateSaveAsDialog(const std::string& title,
- const base::FilePath& default_path,
- gfx::NativeWindow parent, void* params);
-
- // Common function for OnSelectSingleFileDialogResponse and
- // OnSelectSingleFolderDialogResponse.
- void SelectSingleFileHelper(const std::string& output, int exit_code,
- void* params, bool allow_folder);
-
- void OnSelectSingleFileDialogResponse(const std::string& output,
- int exit_code, void* params);
- void OnSelectMultiFileDialogResponse(const std::string& output,
- int exit_code, void* params);
- void OnSelectSingleFolderDialogResponse(const std::string& output,
- int exit_code, void* params);
-
- // Should be either DESKTOP_ENVIRONMENT_KDE3 or DESKTOP_ENVIRONMENT_KDE4.
- base::nix::DesktopEnvironment desktop_;
-
- DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImplKDE);
-};
-
-SelectFileDialogImplKDE::SelectFileDialogImplKDE(
- Listener* listener,
- ui::SelectFilePolicy* policy,
- base::nix::DesktopEnvironment desktop)
- : SelectFileDialogImpl(listener, policy),
- desktop_(desktop) {
- DCHECK(desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE3 ||
- desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE4);
-}
-
-SelectFileDialogImplKDE::~SelectFileDialogImplKDE() {
-}
-
-// We ignore |default_extension|.
-void SelectFileDialogImplKDE::SelectFileImpl(
- Type type,
- const base::string16& title,
- const base::FilePath& default_path,
- const FileTypeInfo* file_types,
- int file_type_index,
- const base::FilePath::StringType& default_extension,
- gfx::NativeWindow owning_window,
- void* params) {
- type_ = type;
- // |owning_window| can be null when user right-clicks on a downloadable item
- // and chooses 'Open Link in New Tab' when 'Ask where to save each file
- // before downloading.' preference is turned on. (http://crbug.com/29213)
- if (owning_window)
- parents_.insert(owning_window);
-
- std::string title_string = UTF16ToUTF8(title);
-
- file_type_index_ = file_type_index;
- if (file_types)
- file_types_ = *file_types;
- else
- file_types_.include_all_files = true;
-
- switch (type) {
- case SELECT_FOLDER:
- case SELECT_UPLOAD_FOLDER:
- CreateSelectFolderDialog(type, title_string, default_path,
- owning_window, params);
- return;
- case SELECT_OPEN_FILE:
- CreateFileOpenDialog(title_string, default_path, owning_window,
- params);
- return;
- case SELECT_OPEN_MULTI_FILE:
- CreateMultiFileOpenDialog(title_string, default_path,
- owning_window, params);
- return;
- case SELECT_SAVEAS_FILE:
- CreateSaveAsDialog(title_string, default_path, owning_window,
- params);
- return;
- default:
- NOTREACHED();
- return;
- }
-}
-
-bool SelectFileDialogImplKDE::HasMultipleFileTypeChoicesImpl() {
- return file_types_.extensions.size() > 1;
-}
-
-std::string SelectFileDialogImplKDE::GetMimeTypeFilterString() {
- std::string filter_string;
- // We need a filter set because the same mime type can appear multiple times.
- std::set<std::string> filter_set;
- for (size_t i = 0; i < file_types_.extensions.size(); ++i) {
- for (size_t j = 0; j < file_types_.extensions[i].size(); ++j) {
- if (!file_types_.extensions[i][j].empty()) {
- std::string mime_type = base::nix::GetFileMimeType(
- base::FilePath("name").ReplaceExtension(
- file_types_.extensions[i][j]));
- filter_set.insert(mime_type);
- }
- }
- }
- // Add the *.* filter, but only if we have added other filters (otherwise it
- // is implied).
- if (file_types_.include_all_files && !file_types_.extensions.empty())
- filter_set.insert("application/octet-stream");
- // Create the final output string.
- filter_string.clear();
- for (std::set<std::string>::iterator it = filter_set.begin();
- it != filter_set.end(); ++it) {
- filter_string.append(*it + " ");
- }
- return filter_string;
-}
-
-void SelectFileDialogImplKDE::CallKDialogOutput(const KDialogParams& params) {
- CommandLine::StringVector cmd_vector;
- cmd_vector.push_back(kKdialogBinary);
- CommandLine command_line(cmd_vector);
- GetKDialogCommandLine(params.type, params.title, params.default_path,
- params.parent, params.file_operation,
- params.multiple_selection, &command_line);
- std::string output;
- int exit_code;
- // Get output from KDialog
- base::GetAppOutputWithExitCode(command_line, &output, &exit_code);
- if (!output.empty())
- output.erase(output.size() - 1);
- // Now the dialog is no longer showing. We can erase its parent from the
- // parent set.
- std::set<GtkWindow*>::iterator iter = parents_.find(params.parent);
- if (iter != parents_.end())
- parents_.erase(iter);
- params.ui_loop_proxy->PostTask(FROM_HERE,
- base::Bind(params.callback, this, output, exit_code,
- params.kdialog_params));
-}
-
-void SelectFileDialogImplKDE::GetKDialogCommandLine(const std::string& type,
- const std::string& title, const base::FilePath& path,
- gfx::NativeWindow parent, bool file_operation, bool multiple_selection,
- CommandLine* command_line) {
- CHECK(command_line);
-
- // Attach to the current Chrome window.
- GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET((parent)));
- int window_id = GDK_DRAWABLE_XID(gdk_window);
- command_line->AppendSwitchNative(
- desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE3 ? "--embed" : "--attach",
- base::IntToString(window_id));
- // Set the correct title for the dialog.
- if (!title.empty())
- command_line->AppendSwitchNative("--title", title);
- // Enable multiple file selection if we need to.
- if (multiple_selection) {
- command_line->AppendSwitch("--multiple");
- command_line->AppendSwitch("--separate-output");
- }
- command_line->AppendSwitch(type);
- // The path should never be empty. If it is, set it to PWD.
- if (path.empty())
- command_line->AppendArgPath(base::FilePath("."));
- else
- command_line->AppendArgPath(path);
- // Depending on the type of the operation we need, get the path to the
- // file/folder and set up mime type filters.
- if (file_operation)
- command_line->AppendArg(GetMimeTypeFilterString());
- VLOG(1) << "KDialog command line: " << command_line->GetCommandLineString();
-}
-
-void SelectFileDialogImplKDE::FileSelected(const base::FilePath& path,
- void* params) {
- if (type_ == SELECT_SAVEAS_FILE)
- *last_saved_path_ = path.DirName();
- else if (type_ == SELECT_OPEN_FILE)
- *last_opened_path_ = path.DirName();
- else if (type_ == SELECT_FOLDER)
- *last_opened_path_ = path;
- else
- NOTREACHED();
- if (listener_) { // What does the filter index actually do?
- // TODO(dfilimon): Get a reasonable index value from somewhere.
- listener_->FileSelected(path, 1, params);
- }
-}
-
-void SelectFileDialogImplKDE::MultiFilesSelected(
- const std::vector<base::FilePath>& files, void* params) {
- *last_opened_path_ = files[0].DirName();
- if (listener_)
- listener_->MultiFilesSelected(files, params);
-}
-
-void SelectFileDialogImplKDE::FileNotSelected(void* params) {
- if (listener_)
- listener_->FileSelectionCanceled(params);
-}
-
-void SelectFileDialogImplKDE::CreateSelectFolderDialog(
- Type type, const std::string& title, const base::FilePath& default_path,
- gfx::NativeWindow parent, void *params) {
- int title_message_id = (type == SELECT_UPLOAD_FOLDER) ?
- IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE :
- IDS_SELECT_FOLDER_DIALOG_TITLE;
- base::WorkerPool::PostTask(FROM_HERE,
- base::Bind(
- &SelectFileDialogImplKDE::CallKDialogOutput,
- this,
- KDialogParams(
- "--getexistingdirectory",
- GetTitle(title, title_message_id),
- default_path.empty() ? *last_opened_path_ : default_path,
- parent, false, false, params,
- &SelectFileDialogImplKDE::OnSelectSingleFolderDialogResponse)),
- true);
-}
-
-void SelectFileDialogImplKDE::CreateFileOpenDialog(
- const std::string& title, const base::FilePath& default_path,
- gfx::NativeWindow parent, void* params) {
- base::WorkerPool::PostTask(FROM_HERE,
- base::Bind(
- &SelectFileDialogImplKDE::CallKDialogOutput,
- this,
- KDialogParams(
- "--getopenfilename",
- GetTitle(title, IDS_OPEN_FILE_DIALOG_TITLE),
- default_path.empty() ? *last_opened_path_ : default_path,
- parent, true, false, params,
- &SelectFileDialogImplKDE::OnSelectSingleFileDialogResponse)),
- true);
-}
-
-void SelectFileDialogImplKDE::CreateMultiFileOpenDialog(
- const std::string& title, const base::FilePath& default_path,
- gfx::NativeWindow parent, void* params) {
- base::WorkerPool::PostTask(FROM_HERE,
- base::Bind(
- &SelectFileDialogImplKDE::CallKDialogOutput,
- this,
- KDialogParams(
- "--getopenfilename",
- GetTitle(title, IDS_OPEN_FILES_DIALOG_TITLE),
- default_path.empty() ? *last_opened_path_ : default_path,
- parent, true, true, params,
- &SelectFileDialogImplKDE::OnSelectMultiFileDialogResponse)),
- true);
-}
-
-void SelectFileDialogImplKDE::CreateSaveAsDialog(
- const std::string& title, const base::FilePath& default_path,
- gfx::NativeWindow parent, void* params) {
- base::WorkerPool::PostTask(FROM_HERE,
- base::Bind(
- &SelectFileDialogImplKDE::CallKDialogOutput,
- this,
- KDialogParams(
- "--getsavefilename",
- GetTitle(title, IDS_SAVE_AS_DIALOG_TITLE),
- default_path.empty() ? *last_saved_path_ : default_path,
- parent, true, false, params,
- &SelectFileDialogImplKDE::OnSelectSingleFileDialogResponse)),
- true);
-}
-
-void SelectFileDialogImplKDE::SelectSingleFileHelper(const std::string& output,
- int exit_code, void* params, bool allow_folder) {
- VLOG(1) << "[kdialog] SingleFileResponse: " << output;
- if (exit_code != 0 || output.empty()) {
- FileNotSelected(params);
- return;
- }
-
- base::FilePath path(output);
- if (allow_folder) {
- FileSelected(path, params);
- return;
- }
-
- if (CallDirectoryExistsOnUIThread(path))
- FileNotSelected(params);
- else
- FileSelected(path, params);
-}
-
-void SelectFileDialogImplKDE::OnSelectSingleFileDialogResponse(
- const std::string& output, int exit_code, void* params) {
- SelectSingleFileHelper(output, exit_code, params, false);
-}
-
-void SelectFileDialogImplKDE::OnSelectSingleFolderDialogResponse(
- const std::string& output, int exit_code, void* params) {
- SelectSingleFileHelper(output, exit_code, params, true);
-}
-
-void SelectFileDialogImplKDE::OnSelectMultiFileDialogResponse(
- const std::string& output, int exit_code, void* params) {
- VLOG(1) << "[kdialog] MultiFileResponse: " << output;
-
- if (exit_code != 0 || output.empty()) {
- FileNotSelected(params);
- return;
- }
-
- std::vector<std::string> filenames;
- Tokenize(output, "\n", &filenames);
- std::vector<base::FilePath> filenames_fp;
- for (std::vector<std::string>::iterator iter = filenames.begin();
- iter != filenames.end(); ++iter) {
- base::FilePath path(*iter);
- if (CallDirectoryExistsOnUIThread(path))
- continue;
- filenames_fp.push_back(path);
- }
-
- if (filenames_fp.empty()) {
- FileNotSelected(params);
- return;
- }
- MultiFilesSelected(filenames_fp, params);
-}
-
-} // namespace
-
-namespace ui {
-
-// static
-bool SelectFileDialogImpl::CheckKDEDialogWorksOnUIThread() {
- // No choice. UI thread can't continue without an answer here. Fortunately we
- // only do this once, the first time a file dialog is displayed.
- base::ThreadRestrictions::ScopedAllowIO allow_io;
-
- CommandLine::StringVector cmd_vector;
- cmd_vector.push_back(kKdialogBinary);
- cmd_vector.push_back("--version");
- CommandLine command_line(cmd_vector);
- std::string dummy;
- return base::GetAppOutput(command_line, &dummy);
-}
-
-// static
-SelectFileDialogImpl* SelectFileDialogImpl::NewSelectFileDialogImplKDE(
- Listener* listener,
- ui::SelectFilePolicy* policy,
- base::nix::DesktopEnvironment desktop) {
- return new SelectFileDialogImplKDE(listener, policy, desktop);
-}
-
-} // namespace ui
diff --git a/chromium/ui/shell_dialogs/print_settings_dialog_win.cc b/chromium/ui/shell_dialogs/print_settings_dialog_win.cc
deleted file mode 100644
index f3f89b3ed71..00000000000
--- a/chromium/ui/shell_dialogs/print_settings_dialog_win.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/shell_dialogs/print_settings_dialog_win.h"
-
-#include "base/bind.h"
-#include "base/threading/thread.h"
-
-#if defined(USE_AURA)
-#include "ui/aura/root_window.h"
-#endif
-
-namespace ui {
-
-PrintSettingsDialogWin::PrintSettingsDialogWin(
- PrintSettingsDialogWin::Observer* observer)
- : observer_(observer) {
-}
-
-PrintSettingsDialogWin::~PrintSettingsDialogWin() {
-}
-
-void PrintSettingsDialogWin::GetPrintSettings(PrintDialogFunc print_dialog_func,
- HWND owning_window,
- PRINTDLGEX* dialog_options) {
- DCHECK(observer_);
-
- ExecutePrintSettingsParams execute_params(BeginRun(owning_window),
- owning_window,
- print_dialog_func,
- dialog_options);
- execute_params.run_state.dialog_thread->message_loop()->PostTask(
- FROM_HERE,
- base::Bind(
- &PrintSettingsDialogWin::ExecutePrintSettings, this, execute_params));
-}
-
-void PrintSettingsDialogWin::ExecutePrintSettings(
- const ExecutePrintSettingsParams& params) {
- HRESULT hr = (*params.print_dialog_func)(params.dialog_options);
- params.ui_proxy->PostTask(
- FROM_HERE,
- base::Bind(
- &PrintSettingsDialogWin::PrintSettingsCompleted, this, hr, params));
-}
-
-void PrintSettingsDialogWin::PrintSettingsCompleted(
- HRESULT hresult,
- const ExecutePrintSettingsParams& params) {
- EndRun(params.run_state);
- if (hresult != S_OK)
- observer_->PrintSettingsCancelled(params.dialog_options);
- else
- observer_->PrintSettingsConfirmed(params.dialog_options);
-}
-
-} // namespace ui
diff --git a/chromium/ui/shell_dialogs/print_settings_dialog_win.h b/chromium/ui/shell_dialogs/print_settings_dialog_win.h
deleted file mode 100644
index 6a1efed5899..00000000000
--- a/chromium/ui/shell_dialogs/print_settings_dialog_win.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_SHELL_DIALOGS_PRINT_SETTINGS_DIALOG_WIN_H_
-#define UI_SHELL_DIALOGS_PRINT_SETTINGS_DIALOG_WIN_H_
-
-#include <ocidl.h>
-#include <commdlg.h>
-
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_loop_proxy.h"
-#include "ui/shell_dialogs/base_shell_dialog_win.h"
-#include "ui/shell_dialogs/shell_dialogs_export.h"
-
-namespace ui {
-
-// A thin wrapper around the native window print dialog that uses
-// BaseShellDialog to have the dialog run on a background thread.
-class SHELL_DIALOGS_EXPORT PrintSettingsDialogWin
- : public base::RefCountedThreadSafe<PrintSettingsDialogWin>,
- public BaseShellDialogImpl {
- public:
- class SHELL_DIALOGS_EXPORT Observer {
- public:
- virtual void PrintSettingsConfirmed(PRINTDLGEX* dialog_options) = 0;
- virtual void PrintSettingsCancelled(PRINTDLGEX* dialog_options) = 0;
- };
- typedef HRESULT(__stdcall* PrintDialogFunc)(PRINTDLGEX*);
-
- explicit PrintSettingsDialogWin(Observer* observer);
- virtual ~PrintSettingsDialogWin();
-
- // Called to open the system print dialog on a background thread.
- // |print_dialog_func| should generally be ::PrintDlgEx, however alternate
- // functions are used for testing. |owning_window| is the parent HWND, and
- // |dialog_options| is passed to |print_dialog_func|.
- void GetPrintSettings(
- PrintDialogFunc print_dialog_func,
- HWND owning_window,
- PRINTDLGEX* dialog_options);
-
- private:
- // A struct for holding all the state necessary for displaying the print
- // settings dialog.
- struct ExecutePrintSettingsParams {
- ExecutePrintSettingsParams(RunState run_state,
- HWND owner,
- PrintDialogFunc print_dialog_func,
- PRINTDLGEX* dialog_options)
- : run_state(run_state),
- owner(owner),
- print_dialog_func(print_dialog_func),
- dialog_options(dialog_options),
- ui_proxy(base::MessageLoopForUI::current()->message_loop_proxy()) {}
-
- RunState run_state;
- HWND owner;
- PrintDialogFunc print_dialog_func;
- PRINTDLGEX* dialog_options;
- scoped_refptr<base::MessageLoopProxy> ui_proxy;
- };
-
- // Runs the print dialog. Should be run on the the BaseShellDialogImpl thread.
- // Posts back to PrintSettingsCompleted on the UI thread on completion.
- void ExecutePrintSettings(const ExecutePrintSettingsParams& params);
-
- // Handler for the result of the print settings dialog. Should be run on the
- // UI thread, and notifies the observer of the result of the dialog.
- void PrintSettingsCompleted(HRESULT hresult,
- const ExecutePrintSettingsParams& params);
-
- // Observer that's notified when the dialog is confirmed or cancelled.
- Observer* observer_;
-
- DISALLOW_COPY_AND_ASSIGN(PrintSettingsDialogWin);
-};
-
-} // namespace ui
-
-#endif // UI_SHELL_DIALOGS_PRINT_SETTINGS_DIALOG_WIN_H_
diff --git a/chromium/ui/shell_dialogs/select_file_dialog.cc b/chromium/ui/shell_dialogs/select_file_dialog.cc
index 06dd13ef29a..e0449a7b0a3 100644
--- a/chromium/ui/shell_dialogs/select_file_dialog.cc
+++ b/chromium/ui/shell_dialogs/select_file_dialog.cc
@@ -18,11 +18,9 @@
#include "ui/shell_dialogs/select_file_dialog_win.h"
#elif defined(OS_MACOSX)
#include "ui/shell_dialogs/select_file_dialog_mac.h"
-#elif defined(TOOLKIT_GTK)
-#include "ui/shell_dialogs/gtk/select_file_dialog_impl.h"
#elif defined(OS_ANDROID)
#include "ui/shell_dialogs/select_file_dialog_android.h"
-#elif defined(USE_AURA) && !defined(USE_ASH) && defined(OS_LINUX)
+#elif defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS)
#include "ui/shell_dialogs/linux_shell_dialog.h"
#endif
@@ -78,7 +76,7 @@ scoped_refptr<SelectFileDialog> SelectFileDialog::Create(
return dialog;
}
-#if defined(USE_AURA) && !defined(USE_ASH) && defined(OS_LINUX)
+#if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS)
const ui::LinuxShellDialog* shell_dialogs = ui::LinuxShellDialog::instance();
if (shell_dialogs)
return shell_dialogs->CreateSelectFileDialog(listener, policy);
@@ -90,13 +88,12 @@ scoped_refptr<SelectFileDialog> SelectFileDialog::Create(
return CreateWinSelectFileDialog(listener, policy);
#elif defined(OS_MACOSX) && !defined(USE_AURA)
return CreateMacSelectFileDialog(listener, policy);
-#elif defined(TOOLKIT_GTK)
- return CreateLinuxSelectFileDialog(listener, policy);
#elif defined(OS_ANDROID)
return CreateAndroidSelectFileDialog(listener, policy);
-#endif
-
+#else
+ NOTIMPLEMENTED();
return NULL;
+#endif
}
void SelectFileDialog::SelectFile(
diff --git a/chromium/ui/shell_dialogs/select_file_dialog_android.cc b/chromium/ui/shell_dialogs/select_file_dialog_android.cc
index 290d5091ef6..af15c977b0b 100644
--- a/chromium/ui/shell_dialogs/select_file_dialog_android.cc
+++ b/chromium/ui/shell_dialogs/select_file_dialog_android.cc
@@ -40,8 +40,6 @@ void SelectFileDialogImpl::OnFileSelected(JNIEnv* env,
file_info.display_name = file_name;
listener_->FileSelectedWithExtraInfo(file_info, 0, NULL);
}
-
- is_running_ = false;
}
void SelectFileDialogImpl::OnFileNotSelected(
@@ -49,12 +47,10 @@ void SelectFileDialogImpl::OnFileNotSelected(
jobject java_object) {
if (listener_)
listener_->FileSelectionCanceled(NULL);
-
- is_running_ = false;
}
bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow) const {
- return is_running_;
+ return listener_;
}
void SelectFileDialogImpl::ListenerDestroyed() {
@@ -89,7 +85,6 @@ void SelectFileDialogImpl::SelectFileImpl(
accept_types_java.obj(),
accept_types.second,
owning_window->GetJavaObject().obj());
- is_running_ = true;
}
bool SelectFileDialogImpl::RegisterSelectFileDialog(JNIEnv* env) {
@@ -101,7 +96,7 @@ SelectFileDialogImpl::~SelectFileDialogImpl() {
SelectFileDialogImpl::SelectFileDialogImpl(Listener* listener,
SelectFilePolicy* policy)
- : SelectFileDialog(listener, policy), is_running_(false) {
+ : SelectFileDialog(listener, policy) {
JNIEnv* env = base::android::AttachCurrentThread();
java_object_.Reset(
Java_SelectFileDialog_create(env, reinterpret_cast<intptr_t>(this)));
diff --git a/chromium/ui/shell_dialogs/select_file_dialog_android.h b/chromium/ui/shell_dialogs/select_file_dialog_android.h
index 26903086c7d..1b09d1e36d3 100644
--- a/chromium/ui/shell_dialogs/select_file_dialog_android.h
+++ b/chromium/ui/shell_dialogs/select_file_dialog_android.h
@@ -53,9 +53,6 @@ class SelectFileDialogImpl : public SelectFileDialog {
base::android::ScopedJavaGlobalRef<jobject> java_object_;
- // Stores the state whether select_file_dialog is running.
- bool is_running_;
-
DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl);
};
diff --git a/chromium/ui/shell_dialogs/select_file_dialog_win.cc b/chromium/ui/shell_dialogs/select_file_dialog_win.cc
index 1f8e36458bc..00a1f7e1168 100644
--- a/chromium/ui/shell_dialogs/select_file_dialog_win.cc
+++ b/chromium/ui/shell_dialogs/select_file_dialog_win.cc
@@ -26,16 +26,14 @@
#include "base/win/shortcut.h"
#include "base/win/windows_version.h"
#include "grit/ui_strings.h"
+#include "ui/aura/window.h"
+#include "ui/aura/window_event_dispatcher.h"
+#include "ui/aura/window_tree_host.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/shell_dialogs/base_shell_dialog_win.h"
#include "ui/shell_dialogs/shell_dialogs_delegate.h"
-
-#if defined(USE_AURA)
-#include "ui/aura/remote_root_window_host_win.h"
-#include "ui/aura/root_window.h"
-#include "ui/aura/window.h"
-#endif
+#include "win8/viewer/metro_viewer_process_host.h"
namespace {
@@ -85,7 +83,7 @@ bool CallGetSaveFileName(OPENFILENAME* ofn) {
// Distinguish directories from regular files.
bool IsDirectory(const base::FilePath& path) {
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
return base::GetFileInfo(path, &file_info) ?
file_info.is_directory : path.EndsWithSeparator();
}
@@ -171,7 +169,7 @@ std::wstring FormatFilterForExtensions(
include_all_files = true;
desc = l10n_util::GetStringFUTF16(
IDS_APP_SAVEAS_EXTENSION_FORMAT,
- base::i18n::ToUpper(WideToUTF16(ext_name)),
+ base::i18n::ToUpper(base::WideToUTF16(ext_name)),
ext_name);
}
if (desc.empty())
@@ -517,7 +515,8 @@ class SelectFileDialogImpl : public ui::SelectFileDialog,
// Returns the filter to be used while displaying the open/save file dialog.
// This is computed from the extensions for the file types being opened.
- base::string16 GetFilterForFileTypes(const FileTypeInfo& file_types);
+ // |file_types| can be NULL in which case the returned filter will be empty.
+ base::string16 GetFilterForFileTypes(const FileTypeInfo* file_types);
bool has_multiple_file_type_choices_;
@@ -545,16 +544,15 @@ void SelectFileDialogImpl::SelectFileImpl(
void* params) {
has_multiple_file_type_choices_ =
file_types ? file_types->extensions.size() > 1 : true;
-#if defined(USE_AURA)
// If the owning_window passed in is in metro then we need to forward the
// file open/save operations to metro.
if (GetShellDialogsDelegate() &&
GetShellDialogsDelegate()->IsWindowInMetro(owning_window)) {
if (type == SELECT_SAVEAS_FILE) {
- aura::HandleSaveFile(
- UTF16ToWide(title),
+ win8::MetroViewerProcessHost::HandleSaveFile(
+ title,
default_path,
- GetFilterForFileTypes(*file_types),
+ GetFilterForFileTypes(file_types),
file_type_index,
default_extension,
base::Bind(&ui::SelectFileDialog::Listener::FileSelected,
@@ -563,20 +561,20 @@ void SelectFileDialogImpl::SelectFileImpl(
base::Unretained(listener_)));
return;
} else if (type == SELECT_OPEN_FILE) {
- aura::HandleOpenFile(
- UTF16ToWide(title),
+ win8::MetroViewerProcessHost::HandleOpenFile(
+ title,
default_path,
- GetFilterForFileTypes(*file_types),
+ GetFilterForFileTypes(file_types),
base::Bind(&ui::SelectFileDialog::Listener::FileSelected,
base::Unretained(listener_)),
base::Bind(&ui::SelectFileDialog::Listener::FileSelectionCanceled,
base::Unretained(listener_)));
return;
} else if (type == SELECT_OPEN_MULTI_FILE) {
- aura::HandleOpenMultipleFiles(
- UTF16ToWide(title),
+ win8::MetroViewerProcessHost::HandleOpenMultipleFiles(
+ title,
default_path,
- GetFilterForFileTypes(*file_types),
+ GetFilterForFileTypes(file_types),
base::Bind(&ui::SelectFileDialog::Listener::MultiFilesSelected,
base::Unretained(listener_)),
base::Bind(&ui::SelectFileDialog::Listener::FileSelectionCanceled,
@@ -590,8 +588,8 @@ void SelectFileDialogImpl::SelectFileImpl(
title_string = l10n_util::GetStringUTF16(
IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE);
}
- aura::HandleSelectFolder(
- UTF16ToWide(title_string),
+ win8::MetroViewerProcessHost::HandleSelectFolder(
+ title_string,
base::Bind(&ui::SelectFileDialog::Listener::FileSelected,
base::Unretained(listener_)),
base::Bind(&ui::SelectFileDialog::Listener::FileSelectionCanceled,
@@ -600,12 +598,10 @@ void SelectFileDialogImpl::SelectFileImpl(
}
}
HWND owner = owning_window && owning_window->GetRootWindow()
- ? owning_window->GetDispatcher()->host()->GetAcceleratedWidget() : NULL;
-#else
- HWND owner = owning_window;
-#endif
- ExecuteSelectParams execute_params(type, UTF16ToWide(title), default_path,
- file_types, file_type_index,
+ ? owning_window->GetHost()->GetAcceleratedWidget() : NULL;
+
+ ExecuteSelectParams execute_params(type, title,
+ default_path, file_types, file_type_index,
default_extension, BeginRun(owner),
owner, params);
execute_params.run_state.dialog_thread->message_loop()->PostTask(
@@ -619,13 +615,9 @@ bool SelectFileDialogImpl::HasMultipleFileTypeChoicesImpl() {
}
bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow owning_window) const {
-#if defined(USE_AURA)
if (!owning_window->GetRootWindow())
return false;
- HWND owner = owning_window->GetDispatcher()->host()->GetAcceleratedWidget();
-#else
- HWND owner = owning_window;
-#endif
+ HWND owner = owning_window->GetHost()->GetAcceleratedWidget();
return listener_ && IsRunningDialogForOwner(owner);
}
@@ -637,7 +629,7 @@ void SelectFileDialogImpl::ListenerDestroyed() {
void SelectFileDialogImpl::ExecuteSelectFile(
const ExecuteSelectParams& params) {
- base::string16 filter = GetFilterForFileTypes(params.file_types);
+ base::string16 filter = GetFilterForFileTypes(&params.file_types);
base::FilePath path = params.default_path;
bool success = false;
@@ -647,8 +639,7 @@ void SelectFileDialogImpl::ExecuteSelectFile(
if (title.empty() && params.type == SELECT_UPLOAD_FOLDER) {
// If it's for uploading don't use default dialog title to
// make sure we clearly tell it's for uploading.
- title = UTF16ToWide(
- l10n_util::GetStringUTF16(IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE));
+ title = l10n_util::GetStringUTF16(IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE);
}
success = RunSelectFolderDialog(title,
params.run_state.owner,
@@ -881,10 +872,13 @@ bool SelectFileDialogImpl::RunOpenMultiFileDialog(
}
base::string16 SelectFileDialogImpl::GetFilterForFileTypes(
- const FileTypeInfo& file_types) {
+ const FileTypeInfo* file_types) {
+ if (!file_types)
+ return base::string16();
+
std::vector<base::string16> exts;
- for (size_t i = 0; i < file_types.extensions.size(); ++i) {
- const std::vector<base::string16>& inner_exts = file_types.extensions[i];
+ for (size_t i = 0; i < file_types->extensions.size(); ++i) {
+ const std::vector<base::string16>& inner_exts = file_types->extensions[i];
base::string16 ext_string;
for (size_t j = 0; j < inner_exts.size(); ++j) {
if (!ext_string.empty())
@@ -896,8 +890,8 @@ base::string16 SelectFileDialogImpl::GetFilterForFileTypes(
}
return FormatFilterForExtensions(
exts,
- file_types.extension_description_overrides,
- file_types.include_all_files);
+ file_types->extension_description_overrides,
+ file_types->include_all_files);
}
} // namespace
diff --git a/chromium/ui/shell_dialogs/shell_dialogs.gyp b/chromium/ui/shell_dialogs/shell_dialogs.gyp
index 2df94354eb1..3cc00938d74 100644
--- a/chromium/ui/shell_dialogs/shell_dialogs.gyp
+++ b/chromium/ui/shell_dialogs/shell_dialogs.gyp
@@ -14,8 +14,8 @@
'../../base/base.gyp:base',
'../../base/base.gyp:base_i18n',
'../../skia/skia.gyp:skia',
- '../base/strings/ui_strings.gyp:ui_strings',
- '../ui.gyp:ui',
+ '../base/ui_base.gyp:ui_base',
+ '../strings/ui_strings.gyp:ui_strings',
],
'defines': [
'SHELL_DIALOGS_IMPLEMENTATION',
@@ -27,14 +27,8 @@
'base_shell_dialog.h',
'base_shell_dialog_win.cc',
'base_shell_dialog_win.h',
- 'gtk/select_file_dialog_impl.cc',
- 'gtk/select_file_dialog_impl.h',
- 'gtk/select_file_dialog_impl_gtk.cc',
- 'gtk/select_file_dialog_impl_kde.cc',
'linux_shell_dialog.cc',
'linux_shell_dialog.h',
- 'print_settings_dialog_win.cc',
- 'print_settings_dialog_win.h',
'select_file_dialog.cc',
'select_file_dialog.h',
'select_file_dialog_android.cc',
@@ -64,7 +58,7 @@
['OS=="android"',
{
'dependencies': [
- '../ui.gyp:ui_base_jni_headers',
+ '../base/ui_base.gyp:ui_base_jni_headers',
],
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)/ui',
@@ -83,7 +77,28 @@
],
}
],
+ ['OS=="win"',
+ {
+ 'dependencies': [
+ '../../win8/win8.gyp:metro_viewer',
+ ],
+ }
+ ],
],
}, # target_name: shell_dialogs
+ {
+ 'target_name': 'shell_dialogs_unittests',
+ 'type': 'executable',
+ 'dependencies': [
+ '../../base/base.gyp:base',
+ '../../base/base.gyp:test_support_base',
+ '../../base/base.gyp:run_all_unittests',
+ '../../testing/gtest.gyp:gtest',
+ 'shell_dialogs',
+ ],
+ 'sources': [
+ 'select_file_dialog_win_unittest.cc',
+ ],
+ },
],
}