diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-30 22:22:49 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-30 22:22:49 +0000 |
commit | f7578f5d14dbd1c2931b7f574ead27cc978ab73a (patch) | |
tree | ddb316a54abc01a6219e4d129062390af5759be9 /chrome/browser/google_update.h | |
parent | 439764b703a5edd48aa878b86fbd07a117b6a3cc (diff) | |
download | chromium_src-f7578f5d14dbd1c2931b7f574ead27cc978ab73a.zip chromium_src-f7578f5d14dbd1c2931b7f574ead27cc978ab73a.tar.gz chromium_src-f7578f5d14dbd1c2931b7f574ead27cc978ab73a.tar.bz2 |
Move Google-specific code under browser/ into browser/google/.
BUG=50548
TEST=compiles
Review URL: http://codereview.chromium.org/3280008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57922 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/google_update.h')
-rw-r--r-- | chrome/browser/google_update.h | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/chrome/browser/google_update.h b/chrome/browser/google_update.h deleted file mode 100644 index 8487cd8..0000000 --- a/chrome/browser/google_update.h +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) 2010 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_GOOGLE_UPDATE_H_ -#define CHROME_BROWSER_GOOGLE_UPDATE_H_ -#pragma once - -#include <string> - -#include "base/basictypes.h" -#include "base/ref_counted.h" -#if defined(OS_WIN) -#include "google_update_idl.h" -#endif - -class MessageLoop; -namespace views { -class Window; -} - -// The status of the upgrade. UPGRADE_STARTED and UPGRADE_CHECK_STARTED are -// internal states and will not be reported as results to the listener. -enum GoogleUpdateUpgradeResult { - // The upgrade has started. - UPGRADE_STARTED = 0, - // A check for upgrade has been initiated. - UPGRADE_CHECK_STARTED, - // An update is available. - UPGRADE_IS_AVAILABLE, - // The upgrade happened successfully. - UPGRADE_SUCCESSFUL, - // No need to upgrade, we are up to date. - UPGRADE_ALREADY_UP_TO_DATE, - // An error occurred. - UPGRADE_ERROR, -}; - -enum GoogleUpdateErrorCode { - // The upgrade completed successfully (or hasn't been started yet). - GOOGLE_UPDATE_NO_ERROR = 0, - // Google Update only supports upgrading if Chrome is installed in the default - // location. This error will appear for developer builds and with - // installations unzipped to random locations. - CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY, - // Failed to create Google Update JobServer COM class. - GOOGLE_UPDATE_JOB_SERVER_CREATION_FAILED, - // Failed to create Google Update OnDemand COM class. - GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND, - // Google Update OnDemand COM class reported an error during a check for - // update (or while upgrading). - GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR, - // A call to GetResults failed. - GOOGLE_UPDATE_GET_RESULT_CALL_FAILED, - // A call to GetVersionInfo failed. - GOOGLE_UPDATE_GET_VERSION_INFO_FAILED, - // An error occurred while upgrading (or while checking for update). - // Check the Google Update log in %TEMP% for more details. - GOOGLE_UPDATE_ERROR_UPDATING, -}; - -// The GoogleUpdateStatusListener interface is used by components to receive -// notifications about the results of an Google Update operation. -class GoogleUpdateStatusListener { - public: - // This function is called when Google Update has finished its operation and - // wants to notify us about the results. |results| represents what the end - // state is, |error_code| represents what error occurred and |version| - // specifies what new version Google Update detected (or installed). This - // value can be a blank string, if the version tag in the Update{} block - // (in Google Update's server config for Chrome) is blank. - virtual void OnReportResults(GoogleUpdateUpgradeResult results, - GoogleUpdateErrorCode error_code, - const std::wstring& version) = 0; -}; - -//////////////////////////////////////////////////////////////////////////////// -// -// The Google Update class is responsible for communicating with Google Update -// and get it to perform operations on our behalf (for example, CheckForUpdate). -// This class will report back to its parent via the GoogleUpdateStatusListener -// interface and will delete itself after reporting back. -// -//////////////////////////////////////////////////////////////////////////////// -class GoogleUpdate : public base::RefCountedThreadSafe<GoogleUpdate> { - public: - GoogleUpdate(); - - // Ask Google Update to see if a new version is available. If the parameter - // |install_if_newer| is true then Google Update will also install that new - // version. - // |window| should point to a foreground window. This is needed to ensure - // that Vista/Windows 7 UAC prompts show up in the foreground. It may also - // be null. - void CheckForUpdate(bool install_if_newer, views::Window* window); - - // Pass NULL to clear the listener - void set_status_listener(GoogleUpdateStatusListener* listener) { - listener_ = listener; - } - - private: - friend class base::RefCountedThreadSafe<GoogleUpdate>; - - virtual ~GoogleUpdate(); - -// The chromeos implementation is in browser/chromeos/google_update.cpp - -#if defined(OS_WIN) - - // This function reports failure from the Google Update operation to the - // listener. - // Note, after this function completes, this object will have deleted itself. - bool ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code, - MessageLoop* main_loop); - -#endif - - // We need to run the update check on another thread than the main thread, and - // therefore CheckForUpdate will delegate to this function. |main_loop| points - // to the message loop that we want the response to come from. - // |window| should point to a foreground window. This is needed to ensure that - // Vista/Windows 7 UAC prompts show up in the foreground. It may also be null. - bool InitiateGoogleUpdateCheck(bool install_if_newer, views::Window* window, - MessageLoop* main_loop); - - // This function reports the results of the GoogleUpdate operation to the - // listener. If results indicates an error, the error_code will indicate which - // error occurred. - // Note, after this function completes, this object will have deleted itself. - void ReportResults(GoogleUpdateUpgradeResult results, - GoogleUpdateErrorCode error_code); - - // Which version string Google Update found (if a new one was available). - // Otherwise, this will be blank. - std::wstring version_available_; - - // The listener who is interested in finding out the result of the operation. - GoogleUpdateStatusListener* listener_; - - DISALLOW_COPY_AND_ASSIGN(GoogleUpdate); -}; - -#endif // CHROME_BROWSER_GOOGLE_UPDATE_H_ |