diff options
author | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-19 10:51:29 +0000 |
---|---|---|
committer | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-19 10:51:29 +0000 |
commit | 53ae3ced739a432c20b70c7bee1ae5527ba786ce (patch) | |
tree | e6ee3b1b638d86a26ac466c0fbe17f67415178b2 /chrome/browser/debugger/devtools_file_helper.h | |
parent | 92b43f98d619fcc8d03e2bb90217f44a0b4cd76e (diff) | |
download | chromium_src-53ae3ced739a432c20b70c7bee1ae5527ba786ce.zip chromium_src-53ae3ced739a432c20b70c7bee1ae5527ba786ce.tar.gz chromium_src-53ae3ced739a432c20b70c7bee1ae5527ba786ce.tar.bz2 |
Revert r173891 - "DevTools: rename debugger/ to devtools/, move DevTools files into content/renderer/devtools."
DevToolsManagerTest.ForwardMessageToClient:
http://build.chromium.org/p/chromium.linux/buildstatus?builder=Linux%20Tests%20x64&number=29428
http://build.chromium.org/p/chromium.linux/buildstatus?builder=Linux%20Aura&number=304
http://build.chromium.org/p/chromium.linux/buildstatus?builder=Linux%20Clang%20%28dbg%29&number=37637
http://build.chromium.org/p/chromium.chromiumos/buildstatus?builder=Linux%20ChromiumOS%20Tests%20%281%29&number=17804
http://build.chromium.org/p/chromium.memory/buildstatus?builder=Linux%20Chromium%20OS%20ASAN%20Tests%20%283%29&number=1107
BUG=None
TEST=Tree becomes greener.
TBR=pfeldman@chromium.org
Review URL: https://codereview.chromium.org/11645015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173893 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/debugger/devtools_file_helper.h')
-rw-r--r-- | chrome/browser/debugger/devtools_file_helper.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/chrome/browser/debugger/devtools_file_helper.h b/chrome/browser/debugger/devtools_file_helper.h new file mode 100644 index 0000000..641ca5c --- /dev/null +++ b/chrome/browser/debugger/devtools_file_helper.h @@ -0,0 +1,60 @@ +// Copyright (c) 2012 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 CHROME_BROWSER_DEBUGGER_DEVTOOLS_FILE_HELPER_H_ +#define CHROME_BROWSER_DEBUGGER_DEVTOOLS_FILE_HELPER_H_ + +#include <map> +#include <string> + +#include "base/basictypes.h" +#include "base/memory/ref_counted.h" + +class FilePath; +class Profile; + +class DevToolsFileHelper { + public: + class Delegate { + public: + virtual ~Delegate() {} + virtual void FileSavedAs(const std::string& url) = 0; + virtual void AppendedTo(const std::string& url) = 0; + }; + + DevToolsFileHelper(Profile* profile, Delegate* delegate); + ~DevToolsFileHelper(); + + // Saves |content| to the file and associates its path with given |url|. + // If client is calling this method with given |url| for the first time + // or |save_as| is true, confirmation dialog is shown to the user. + void Save(const std::string& url, + const std::string& content, + bool save_as); + + // Append |content| to the file that has been associated with given |url|. + // The |url| can be associated with a file via calling Save method. + // If the Save method has not been called for this |url|, then + // Append method does nothing. + void Append(const std::string& url, const std::string& content); + + void FileSelected(const std::string& url, + const FilePath& path, + const std::string& content); + + private: + static void WriteFile(const FilePath& path, const std::string& content); + static void AppendToFile(const FilePath& path, const std::string& content); + + class SaveAsDialog; + + Profile* profile_; + Delegate* delegate_; + scoped_refptr<SaveAsDialog> save_as_dialog_; + typedef std::map<std::string, FilePath> PathsMap; + PathsMap saved_files_; + DISALLOW_COPY_AND_ASSIGN(DevToolsFileHelper); +}; + +#endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_FILE_HELPER_H_ |