| OLD | NEW |
| 1 // Copyright (c) 2011 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_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/select_file_dialog.h" | 14 #include "chrome/browser/ui/select_file_dialog.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>::Leaky |
| 21 base::LeakyLazyInstanceTraits<FilePath> > | |
| 22 g_last_save_path = LAZY_INSTANCE_INITIALIZER; | 21 g_last_save_path = LAZY_INSTANCE_INITIALIZER; |
| 23 | 22 |
| 24 class SaveAsDialog : public SelectFileDialog::Listener, | 23 class SaveAsDialog : public SelectFileDialog::Listener, |
| 25 public base::RefCounted<SaveAsDialog> { | 24 public base::RefCounted<SaveAsDialog> { |
| 26 public: | 25 public: |
| 27 SaveAsDialog() { | 26 SaveAsDialog() { |
| 28 select_file_dialog_ = SelectFileDialog::Create(this); | 27 select_file_dialog_ = SelectFileDialog::Create(this); |
| 29 } | 28 } |
| 30 | 29 |
| 31 void Show(Profile* profile, | 30 void Show(Profile* profile, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 98 |
| 100 } // namespace | 99 } // namespace |
| 101 | 100 |
| 102 // static | 101 // static |
| 103 void DevToolsFileUtil::SaveAs(Profile* profile, | 102 void DevToolsFileUtil::SaveAs(Profile* profile, |
| 104 const std::string& suggested_file_name, | 103 const std::string& suggested_file_name, |
| 105 const std::string& content) { | 104 const std::string& content) { |
| 106 scoped_refptr<SaveAsDialog> dialog = new SaveAsDialog(); | 105 scoped_refptr<SaveAsDialog> dialog = new SaveAsDialog(); |
| 107 dialog->Show(profile, suggested_file_name, content); | 106 dialog->Show(profile, suggested_file_name, content); |
| 108 } | 107 } |
| OLD | NEW |