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

Side by Side Diff: chrome/browser/debugger/devtools_file_helper.cc

Issue 10698053: Breaks compile on Linux Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 "chrome/browser/debugger/devtools_file_helper.h" 5 #include "chrome/browser/debugger/devtools_file_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h"
9 #include "base/file_util.h" 8 #include "base/file_util.h"
10 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
11 #include "base/md5.h" 10 #include "base/md5.h"
12 #include "base/value_conversions.h" 11 #include "base/value_conversions.h"
13 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/download/download_prefs.h" 13 #include "chrome/browser/download/download_prefs.h"
15 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/prefs/scoped_user_pref_update.h" 15 #include "chrome/browser/prefs/scoped_user_pref_update.h"
17 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/chrome_select_file_policy.h"
19 #include "chrome/browser/ui/select_file_dialog.h" 17 #include "chrome/browser/ui/select_file_dialog.h"
20 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
21 19
22 using content::BrowserThread; 20 using content::BrowserThread;
23 21
24 namespace { 22 namespace {
25 23
26 base::LazyInstance<FilePath>::Leaky 24 base::LazyInstance<FilePath>::Leaky
27 g_last_save_path = LAZY_INSTANCE_INITIALIZER; 25 g_last_save_path = LAZY_INSTANCE_INITIALIZER;
28 26
29 } // namespace 27 } // namespace
30 28
31 class DevToolsFileHelper::SaveAsDialog : public SelectFileDialog::Listener, 29 class DevToolsFileHelper::SaveAsDialog : public SelectFileDialog::Listener,
32 public base::RefCounted<SaveAsDialog> { 30 public base::RefCounted<SaveAsDialog> {
33 public: 31 public:
34 explicit SaveAsDialog(DevToolsFileHelper* helper) 32 explicit SaveAsDialog(DevToolsFileHelper* helper)
35 : helper_(helper) { 33 : helper_(helper) {
36 select_file_dialog_ = SelectFileDialog::Create( 34 select_file_dialog_ = SelectFileDialog::Create(this);
37 this, new ChromeSelectFilePolicy(NULL));
38 } 35 }
39 36
40 void ResetHelper() { 37 void ResetHelper() {
41 helper_ = NULL; 38 helper_ = NULL;
42 } 39 }
43 40
44 void Show(const std::string& url, 41 void Show(const std::string& url,
45 const FilePath& initial_path, 42 const FilePath& initial_path,
46 const std::string& content) { 43 const std::string& content) {
47 AddRef(); // Balanced in the three listener outcomes. 44 AddRef(); // Balanced in the three listener outcomes.
48 45
49 url_ = url; 46 url_ = url;
50 content_ = content; 47 content_ = content;
51 48
52 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, 49 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE,
53 string16(), 50 string16(),
54 initial_path, 51 initial_path,
55 NULL, 52 NULL,
56 0, 53 0,
57 FILE_PATH_LITERAL(""), 54 FILE_PATH_LITERAL(""),
58 NULL, 55 NULL,
56 NULL,
59 NULL); 57 NULL);
60 } 58 }
61 59
62 // SelectFileDialog::Listener implementation. 60 // SelectFileDialog::Listener implementation.
63 virtual void FileSelected(const FilePath& path, 61 virtual void FileSelected(const FilePath& path,
64 int index, void* params) { 62 int index, void* params) {
65 if (helper_) 63 if (helper_)
66 helper_->FileSelected(url_, path, content_); 64 helper_->FileSelected(url_, path, content_);
67 Release(); // Balanced in ::Show. 65 Release(); // Balanced in ::Show.
68 } 66 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 files_map->SetWithoutPathExpansion(base::MD5String(url), 181 files_map->SetWithoutPathExpansion(base::MD5String(url),
184 base::CreateFilePathValue(path)); 182 base::CreateFilePathValue(path));
185 delegate_->FileSavedAs(url); 183 delegate_->FileSavedAs(url);
186 184
187 BrowserThread::PostTask( 185 BrowserThread::PostTask(
188 BrowserThread::FILE, FROM_HERE, 186 BrowserThread::FILE, FROM_HERE,
189 base::Bind(&DevToolsFileHelper::WriteFile, 187 base::Bind(&DevToolsFileHelper::WriteFile,
190 path, 188 path,
191 content)); 189 content));
192 } 190 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_browser_handler_api.cc ('k') | chrome/browser/download/download_file_picker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698