Commit 6a3daaa7 authored by achuith@chromium.org's avatar achuith@chromium.org

Add IsBootPath to MountLibrary. Additional boot path check in imageburner so...

Add IsBootPath to MountLibrary. Additional boot path check in imageburner so boot drive is not presented as a target.
BUG=chromium-os:6788
TEST=chrome://imageburner should not display /dev/sda

Review URL: http://codereview.chromium.org/6348006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72733 0039d316-1c4b-4281-b951-d872f2087c98
parent 8f10d9b3
...@@ -39,6 +39,10 @@ class MountLibraryImpl : public MountLibrary { ...@@ -39,6 +39,10 @@ class MountLibraryImpl : public MountLibrary {
return MountDevicePath(device_path); return MountDevicePath(device_path);
} }
bool IsBootPath(const char* device_path) {
return IsBootDevicePath(device_path);
}
const DiskVector& disks() const { return disks_; } const DiskVector& disks() const { return disks_; }
private: private:
...@@ -124,6 +128,7 @@ class MountLibraryStubImpl : public MountLibrary { ...@@ -124,6 +128,7 @@ class MountLibraryStubImpl : public MountLibrary {
virtual void RemoveObserver(Observer* observer) {} virtual void RemoveObserver(Observer* observer) {}
virtual const DiskVector& disks() const { return disks_; } virtual const DiskVector& disks() const { return disks_; }
virtual bool MountPath(const char* device_path) { return false; } virtual bool MountPath(const char* device_path) { return false; }
virtual bool IsBootPath(const char* device_path) { return true; }
private: private:
// The list of disks found. // The list of disks found.
......
...@@ -49,6 +49,7 @@ class MountLibrary { ...@@ -49,6 +49,7 @@ class MountLibrary {
class Observer { class Observer {
public: public:
virtual ~Observer() {}
virtual void MountChanged(MountLibrary* obj, virtual void MountChanged(MountLibrary* obj,
MountEventType evt, MountEventType evt,
const std::string& path) = 0; const std::string& path) = 0;
...@@ -59,6 +60,7 @@ class MountLibrary { ...@@ -59,6 +60,7 @@ class MountLibrary {
virtual void RemoveObserver(Observer* observer) = 0; virtual void RemoveObserver(Observer* observer) = 0;
virtual const DiskVector& disks() const = 0; virtual const DiskVector& disks() const = 0;
virtual bool MountPath(const char* device_path) = 0; virtual bool MountPath(const char* device_path) = 0;
virtual bool IsBootPath(const char* device_path) = 0;
// Factory function, creates a new instance and returns ownership. // Factory function, creates a new instance and returns ownership.
// For normal usage, access the singleton via CrosLibrary::Get(). // For normal usage, access the singleton via CrosLibrary::Get().
......
...@@ -28,37 +28,9 @@ ...@@ -28,37 +28,9 @@
template <typename T> struct DefaultSingletonTraits; template <typename T> struct DefaultSingletonTraits;
static const std::string kPropertyPath = "path";
static const std::string kPropertyTitle = "title";
static const std::string kPropertyDirectory = "isDirectory";
static const std::string kImageBaseURL =
"http://chrome-master.mtv.corp.google.com/chromeos/dev-channel/";
static const std::string kImageFetcherName = "LATEST-x86-generic";
static const std::string kImageFileName = "chromeos_image.bin.gz";
static const std::string kTempImageFolderName = "chromeos_image";
class ImageBurnResourceManager; class ImageBurnResourceManager;
class TabContents; class TabContents;
class ImageBurnUIHTMLSource : public ChromeURLDataManager::DataSource {
public:
ImageBurnUIHTMLSource();
// Called when the network layer has requested a resource underneath
// the path we registered.
virtual void StartDataRequest(const std::string& path,
bool is_off_the_record,
int request_id);
virtual std::string GetMimeType(const std::string&) const {
return "text/html";
}
private:
~ImageBurnUIHTMLSource() {}
DISALLOW_COPY_AND_ASSIGN(ImageBurnUIHTMLSource);
};
class ImageBurnHandler : public DOMMessageHandler, class ImageBurnHandler : public DOMMessageHandler,
public chromeos::MountLibrary::Observer, public chromeos::MountLibrary::Observer,
public chromeos::BurnLibrary::Observer, public chromeos::BurnLibrary::Observer,
...@@ -137,27 +109,6 @@ class ImageBurnHandler : public DOMMessageHandler, ...@@ -137,27 +109,6 @@ class ImageBurnHandler : public DOMMessageHandler,
DISALLOW_COPY_AND_ASSIGN(ImageBurnHandler); DISALLOW_COPY_AND_ASSIGN(ImageBurnHandler);
}; };
class ImageBurnTaskProxy
: public base::RefCountedThreadSafe<ImageBurnTaskProxy> {
public:
explicit ImageBurnTaskProxy(const base::WeakPtr<ImageBurnHandler>& handler);
bool ReportDownloadInitialized();
bool CheckDownloadFinished();
void BurnImage();
void FinalizeBurn(bool success);
void CreateImageUrl(TabContents* tab_contents, ImageBurnHandler* downloader);
private:
base::WeakPtr<ImageBurnHandler> handler_;
ImageBurnResourceManager* resource_manager_;
friend class base::RefCountedThreadSafe<ImageBurnTaskProxy>;
DISALLOW_COPY_AND_ASSIGN(ImageBurnTaskProxy);
};
class ImageBurnResourceManager : public DownloadManager::Observer, class ImageBurnResourceManager : public DownloadManager::Observer,
public DownloadItem::Observer { public DownloadItem::Observer {
public: public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment