OLD | NEW |
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 #include "chrome/browser/debugger/devtools_file_util.h" | 5 #include "chrome/browser/debugger/devtools_file_util.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/download/download_prefs.h" | 12 #include "chrome/browser/download/download_prefs.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/shell_dialogs.h" | 14 #include "chrome/browser/ui/shell_dialogs.h" |
15 | 15 |
16 using content::BrowserThread; | 16 using content::BrowserThread; |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 base::LazyInstance<FilePath, | 20 base::LazyInstance<FilePath, |
21 base::LeakyLazyInstanceTraits<FilePath> > | 21 base::LeakyLazyInstanceTraits<FilePath> > |
22 g_last_save_path(base::LINKER_INITIALIZED); | 22 g_last_save_path = LAZY_INSTANCE_INITIALIZER; |
23 | 23 |
24 class SaveAsDialog : public SelectFileDialog::Listener, | 24 class SaveAsDialog : public SelectFileDialog::Listener, |
25 public base::RefCounted<SaveAsDialog> { | 25 public base::RefCounted<SaveAsDialog> { |
26 public: | 26 public: |
27 SaveAsDialog() { | 27 SaveAsDialog() { |
28 select_file_dialog_ = SelectFileDialog::Create(this); | 28 select_file_dialog_ = SelectFileDialog::Create(this); |
29 } | 29 } |
30 | 30 |
31 void Show(Profile* profile, | 31 void Show(Profile* profile, |
32 const std::string& suggested_file_name, | 32 const std::string& suggested_file_name, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 } // namespace | 100 } // namespace |
101 | 101 |
102 // static | 102 // static |
103 void DevToolsFileUtil::SaveAs(Profile* profile, | 103 void DevToolsFileUtil::SaveAs(Profile* profile, |
104 const std::string& suggested_file_name, | 104 const std::string& suggested_file_name, |
105 const std::string& content) { | 105 const std::string& content) { |
106 scoped_refptr<SaveAsDialog> dialog = new SaveAsDialog(); | 106 scoped_refptr<SaveAsDialog> dialog = new SaveAsDialog(); |
107 dialog->Show(profile, suggested_file_name, content); | 107 dialog->Show(profile, suggested_file_name, content); |
108 } | 108 } |
OLD | NEW |