Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: chrome/browser/ui/webui/version_handler.h

Issue 1486403002: Mojo-ifying chrome://version. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing include Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_WEBUI_VERSION_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_VERSION_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_VERSION_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_VERSION_HANDLER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
Eugene But (OOO till 7-30) 2016/06/04 01:15:25 This file can be shared with iOS. Not much (only i
Eugene But (OOO till 7-30) 2016/06/06 17:20:53 Sorry, I was wrong. This file uses content// which
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "content/public/browser/web_ui_message_handler.h" 13 #include "chrome/browser/ui/webui/mojo_web_ui_handler.h"
14 #include "chrome/browser/ui/webui/version.mojom.h"
15 #include "content/public/browser/web_ui.h"
14 #include "content/public/common/webplugininfo.h" 16 #include "content/public/common/webplugininfo.h"
17 #include "mojo/public/cpp/bindings/binding.h"
15 18
16 // Handler class for Version page operations. 19 // Handler class for Version page operations.
17 class VersionHandler : public content::WebUIMessageHandler { 20 class VersionHandler : public MojoWebUIHandler,
21 public mojom::VersionPageHandler {
18 public: 22 public:
19 VersionHandler(); 23 VersionHandler(content::WebUI* web_ui,
24 mojo::InterfaceRequest<VersionPageHandler> request);
20 ~VersionHandler() override; 25 ~VersionHandler() override;
21 26
22 // content::WebUIMessageHandler implementation. 27 // mojom::VersionPageHandler overrides:
23 void RegisterMessages() override; 28 void GetFilePaths(const GetFilePathsCallback& callback) override;
24 29 void GetFlashVersion(const GetFlashVersionCallback& callback) override;
25 // Callback for the "requestVersionInfo" message. This asynchronously requests 30 void GetVariations(const GetVariationsCallback& callback) override;
26 // the flash version and eventually returns it to the front end along with the 31 void GetOsVersion(const GetOsVersionCallback& callback) override;
27 // list of variations using OnGotPlugins. 32 void GetArcVersion(const GetArcVersionCallback& callback) override;
28 virtual void HandleRequestVersionInfo(const base::ListValue* args);
29 33
30 private: 34 private:
31 // Callback which handles returning the executable and profile paths to the 35 // Callback which handles returning the executable and profile paths to the
32 // front end. 36 // front end.
33 void OnGotFilePaths(base::string16* executable_path_data, 37 void OnGotFilePaths(base::string16* executable_path_data,
34 base::string16* profile_path_data); 38 base::string16* profile_path_data,
39 const GetFilePathsCallback& callback);
35 40
41 #if defined(ENABLE_PLUGINS)
36 // Callback for GetPlugins which responds to the page with the Flash version. 42 // Callback for GetPlugins which responds to the page with the Flash version.
37 // This also initiates the OS Version load on ChromeOS. 43 void OnGotPlugins(const GetFlashVersionCallback& callback,
38 void OnGotPlugins(const std::vector<content::WebPluginInfo>& plugins); 44 const std::vector<content::WebPluginInfo>& plugins);
45 #endif // defined(ENABLE_PLUGINS)
46 #if defined(OS_CHROMEOS)
47 void OnGotOsVersion(const GetOsVersionCallback& callback,
48 const std::string& version);
49 void OnGotArcVersion(const GetOsVersionCallback& callback,
50 const std::string& version);
51 #endif // defined(OS_CHROMEOS)
52
53 content::WebUI* web_ui_;
54 mojo::Binding<mojom::VersionPageHandler> binding_;
39 55
40 // Factory for the creating refs in callbacks. 56 // Factory for the creating refs in callbacks.
41 base::WeakPtrFactory<VersionHandler> weak_ptr_factory_; 57 base::WeakPtrFactory<VersionHandler> weak_ptr_factory_;
42 58
43 DISALLOW_COPY_AND_ASSIGN(VersionHandler); 59 DISALLOW_COPY_AND_ASSIGN(VersionHandler);
44 }; 60 };
45 61
46 #endif // CHROME_BROWSER_UI_WEBUI_VERSION_HANDLER_H_ 62 #endif // CHROME_BROWSER_UI_WEBUI_VERSION_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698