Home | History | Annotate | Download | only in options
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_ABOUT_PAGE_HANDLER_H_
      6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_ABOUT_PAGE_HANDLER_H_
      7 
      8 #include <string>
      9 
     10 #include "chrome/browser/ui/webui/options/options_ui.h"
     11 
     12 #if defined(OS_CHROMEOS)
     13 #include "chrome/browser/chromeos/cros/update_library.h"
     14 #include "chrome/browser/chromeos/version_loader.h"
     15 #endif
     16 
     17 // ChromeOS about page UI handler.
     18 class AboutPageHandler : public OptionsPageUIHandler {
     19  public:
     20   AboutPageHandler();
     21   virtual ~AboutPageHandler();
     22 
     23   // OptionsPageUIHandler implementation.
     24   virtual void GetLocalizedValues(DictionaryValue* localized_strings);
     25   virtual void RegisterMessages();
     26 
     27  private:
     28   // The function is called from JavaScript when the about page is ready.
     29   void PageReady(const ListValue* args);
     30 
     31   // The function is called from JavaScript to set the release track like
     32   // "beta-channel" and "dev-channel".
     33   void SetReleaseTrack(const ListValue* args);
     34 
     35 #if defined(OS_CHROMEOS)
     36   // Initiates update check.
     37   void CheckNow(const ListValue* args);
     38 
     39   // Restarts the system.
     40   void RestartNow(const ListValue* args);
     41 
     42   // Callback from chromeos::VersionLoader giving the version.
     43   void OnOSVersion(chromeos::VersionLoader::Handle handle,
     44                    std::string version);
     45   void OnOSFirmware(chromeos::VersionLoader::Handle handle,
     46                     std::string firmware);
     47   void UpdateStatus(const chromeos::UpdateLibrary::Status& status);
     48 
     49   // UpdateEngine Callback handler.
     50   static void UpdateSelectedChannel(void* user_data, const char* channel);
     51 
     52   // Handles asynchronously loading the version.
     53   chromeos::VersionLoader loader_;
     54 
     55   // Used to request the version.
     56   CancelableRequestConsumer consumer_;
     57 
     58   // Update Observer
     59   class UpdateObserver;
     60   scoped_ptr<UpdateObserver> update_observer_;
     61 
     62   int progress_;
     63   bool sticky_;
     64   bool started_;
     65 #endif
     66 
     67   DISALLOW_COPY_AND_ASSIGN(AboutPageHandler);
     68 };
     69 
     70 #endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_ABOUT_PAGE_HANDLER_H_
     71