| 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/extensions/webstore_installer.h" | 5 #include "chrome/browser/extensions/webstore_installer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "content/public/browser/download_manager.h" | 27 #include "content/public/browser/download_manager.h" |
| 28 #include "content/public/browser/navigation_controller.h" | 28 #include "content/public/browser/navigation_controller.h" |
| 29 #include "content/public/browser/navigation_entry.h" | 29 #include "content/public/browser/navigation_entry.h" |
| 30 #include "content/public/browser/notification_details.h" | 30 #include "content/public/browser/notification_details.h" |
| 31 #include "content/public/browser/notification_source.h" | 31 #include "content/public/browser/notification_source.h" |
| 32 #include "googleurl/src/gurl.h" | 32 #include "googleurl/src/gurl.h" |
| 33 #include "net/base/escape.h" | 33 #include "net/base/escape.h" |
| 34 | 34 |
| 35 using content::BrowserThread; | 35 using content::BrowserThread; |
| 36 using content::DownloadFile; | 36 using content::DownloadFile; |
| 37 using content::NavigationController; |
| 37 | 38 |
| 38 namespace { | 39 namespace { |
| 39 | 40 |
| 40 const char kInvalidIdError[] = "Invalid id"; | 41 const char kInvalidIdError[] = "Invalid id"; |
| 41 const char kNoBrowserError[] = "No browser found"; | 42 const char kNoBrowserError[] = "No browser found"; |
| 42 const char kDownloadDirectoryError[] = "Could not create download directory"; | 43 const char kDownloadDirectoryError[] = "Could not create download directory"; |
| 43 | 44 |
| 44 const char kInlineInstallSource[] = "inline"; | 45 const char kInlineInstallSource[] = "inline"; |
| 45 const char kDefaultInstallSource[] = ""; | 46 const char kDefaultInstallSource[] = ""; |
| 46 | 47 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 98 |
| 98 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 99 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 99 base::Bind(callback, file)); | 100 base::Bind(callback, file)); |
| 100 } | 101 } |
| 101 | 102 |
| 102 } // namespace | 103 } // namespace |
| 103 | 104 |
| 104 | 105 |
| 105 WebstoreInstaller::WebstoreInstaller(Profile* profile, | 106 WebstoreInstaller::WebstoreInstaller(Profile* profile, |
| 106 Delegate* delegate, | 107 Delegate* delegate, |
| 107 content::NavigationController* controller, | 108 NavigationController* controller, |
| 108 const std::string& id, | 109 const std::string& id, |
| 109 int flags) | 110 int flags) |
| 110 : profile_(profile), | 111 : profile_(profile), |
| 111 delegate_(delegate), | 112 delegate_(delegate), |
| 112 controller_(controller), | 113 controller_(controller), |
| 113 id_(id), | 114 id_(id), |
| 114 flags_(flags) { | 115 flags_(flags) { |
| 115 download_url_ = GetWebstoreInstallURL(id, flags & FLAG_INLINE_INSTALL ? | 116 download_url_ = GetWebstoreInstallURL(id, flags & FLAG_INLINE_INSTALL ? |
| 116 kInlineInstallSource : kDefaultInstallSource); | 117 kInlineInstallSource : kDefaultInstallSource); |
| 117 | 118 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 211 |
| 211 Release(); // Balanced in Start(). | 212 Release(); // Balanced in Start(). |
| 212 } | 213 } |
| 213 | 214 |
| 214 void WebstoreInstaller::ReportSuccess() { | 215 void WebstoreInstaller::ReportSuccess() { |
| 215 if (delegate_) | 216 if (delegate_) |
| 216 delegate_->OnExtensionInstallSuccess(id_); | 217 delegate_->OnExtensionInstallSuccess(id_); |
| 217 | 218 |
| 218 Release(); // Balanced in Start(). | 219 Release(); // Balanced in Start(). |
| 219 } | 220 } |
| OLD | NEW |