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

Side by Side Diff: chrome/browser/views/select_file_dialog.cc

Issue 2029007: Fix for assert in SavePackage::ContinueSave(): save package type index outsid... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 | « no previous file | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/shell_dialogs.h" 5 #include "chrome/browser/shell_dialogs.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/scoped_ptr.h" 11 #include "base/scoped_ptr.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/browser.h" 15 #include "chrome/browser/browser.h"
16 #include "chrome/browser/browser_list.h" 16 #include "chrome/browser/browser_list.h"
17 #include "chrome/browser/chrome_thread.h" 17 #include "chrome/browser/chrome_thread.h"
18 #include "chrome/browser/dom_ui/html_dialog_ui.h" 18 #include "chrome/browser/dom_ui/html_dialog_ui.h"
19 #include "chrome/browser/shell_dialogs.h" 19 #include "chrome/browser/shell_dialogs.h"
20 #include "chrome/browser/tab_contents/tab_contents.h" 20 #include "chrome/browser/tab_contents/tab_contents.h"
21 #include "chrome/browser/views/html_dialog_view.h" 21 #include "chrome/browser/views/html_dialog_view.h"
22 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "views/window/non_client_view.h" 24 #include "views/window/non_client_view.h"
25 #include "views/window/window.h" 25 #include "views/window/window.h"
26 26
27 namespace { 27 namespace {
28 28
29 static const wchar_t* kKeyNamePath = L"path"; 29 static const wchar_t* kKeyNamePath = L"path";
30 static const int kSaveCompletePageIndex = 2;
30 31
31 }; // namespace 32 }; // namespace
32 33
33 // Implementation of SelectFileDialog that shows an UI for choosing a file 34 // Implementation of SelectFileDialog that shows an UI for choosing a file
34 // or folder using FileBrowseUI. 35 // or folder using FileBrowseUI.
35 class SelectFileDialogImpl : public SelectFileDialog { 36 class SelectFileDialogImpl : public SelectFileDialog {
36 public: 37 public:
37 explicit SelectFileDialogImpl(Listener* listener); 38 explicit SelectFileDialogImpl(Listener* listener);
38 39
39 // BaseShellDialog implementation. 40 // BaseShellDialog implementation.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } else { 228 } else {
228 const DictionaryValue* dict = static_cast<DictionaryValue*>(value.get()); 229 const DictionaryValue* dict = static_cast<DictionaryValue*>(value.get());
229 if (delegate->type_ == SELECT_OPEN_FILE || 230 if (delegate->type_ == SELECT_OPEN_FILE ||
230 delegate->type_ == SELECT_SAVEAS_FILE || 231 delegate->type_ == SELECT_SAVEAS_FILE ||
231 delegate->type_ == SELECT_FOLDER) { 232 delegate->type_ == SELECT_FOLDER) {
232 std::wstring path_string; 233 std::wstring path_string;
233 if (dict->HasKey(kKeyNamePath) && 234 if (dict->HasKey(kKeyNamePath) &&
234 dict->GetString(kKeyNamePath, &path_string)) { 235 dict->GetString(kKeyNamePath, &path_string)) {
235 FilePath path = FilePath::FromWStringHack(path_string); 236 FilePath path = FilePath::FromWStringHack(path_string);
236 237
237 listener_->FileSelected(path, 0, delegate->params_); 238 listener_->FileSelected(path, kSaveCompletePageIndex,
239 delegate->params_);
238 notification_fired = true; 240 notification_fired = true;
239 } 241 }
240 } else if (delegate->type_ == SELECT_OPEN_MULTI_FILE) { 242 } else if (delegate->type_ == SELECT_OPEN_MULTI_FILE) {
241 ListValue* paths_value = NULL; 243 ListValue* paths_value = NULL;
242 if (dict->HasKey(kKeyNamePath) && 244 if (dict->HasKey(kKeyNamePath) &&
243 dict->GetList(kKeyNamePath, &paths_value) && 245 dict->GetList(kKeyNamePath, &paths_value) &&
244 paths_value) { 246 paths_value) {
245 std::vector<FilePath> paths; 247 std::vector<FilePath> paths;
246 paths.reserve(paths_value->GetSize()); 248 paths.reserve(paths_value->GetSize());
247 for (size_t i = 0; i < paths_value->GetSize(); ++i) { 249 for (size_t i = 0; i < paths_value->GetSize(); ++i) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 // TODO(xiyuan): Change this when the infrastructure is improved. 438 // TODO(xiyuan): Change this when the infrastructure is improved.
437 HtmlDialogUIDelegate** delegate = HtmlDialogUI::GetPropertyAccessor(). 439 HtmlDialogUIDelegate** delegate = HtmlDialogUI::GetPropertyAccessor().
438 GetProperty(dom_ui_->tab_contents()->property_bag()); 440 GetProperty(dom_ui_->tab_contents()->property_bag());
439 HtmlDialogView* containing_view = static_cast<HtmlDialogView*>(*delegate); 441 HtmlDialogView* containing_view = static_cast<HtmlDialogView*>(*delegate);
440 DCHECK(containing_view); 442 DCHECK(containing_view);
441 443
442 containing_view->GetWindow()->UpdateWindowTitle(); 444 containing_view->GetWindow()->UpdateWindowTitle();
443 containing_view->GetWindow()->GetNonClientView()->SchedulePaint(); 445 containing_view->GetWindow()->GetNonClientView()->SchedulePaint();
444 } 446 }
445 } 447 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698