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

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: Addressing comments Created 5 years 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
« no previous file with comments | « chrome/browser/ui/webui/version.mojom ('k') | chrome/browser/ui/webui/version_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "content/public/browser/web_ui_message_handler.h" 12 #include "chrome/browser/ui/webui/mojo_web_ui_handler.h"
13 #include "chrome/browser/ui/webui/version.mojom.h"
14 #include "content/public/browser/web_ui.h"
13 #include "content/public/common/webplugininfo.h" 15 #include "content/public/common/webplugininfo.h"
16 #include "mojo/public/cpp/bindings/strong_binding.h"
14 17
15 // Handler class for Version page operations. 18 // Handler class for Version page operations.
16 class VersionHandler : public content::WebUIMessageHandler { 19 class VersionHandler : public MojoWebUIHandler, public VersionHandlerMojo {
17 public: 20 public:
18 VersionHandler(); 21 VersionHandler(content::WebUI* web_ui,
22 mojo::InterfaceRequest<VersionHandlerMojo> request);
19 ~VersionHandler() override; 23 ~VersionHandler() override;
20 24
21 // content::WebUIMessageHandler implementation. 25 // VersionHandlerMojo overrides:
22 void RegisterMessages() override; 26 void GetFilePaths(const GetFilePathsCallback& callback) override;
23 27 void GetFlashVersion(const GetFlashVersionCallback& callback) override;
24 // Callback for the "requestVersionInfo" message. This asynchronously requests 28 void GetVariations(const GetVariationsCallback& callback) override;
25 // the flash version and eventually returns it to the front end along with the 29 void GetOsVersion(const GetOsVersionCallback& callback) override;
26 // list of variations using OnGotPlugins.
27 virtual void HandleRequestVersionInfo(const base::ListValue* args);
28 30
29 private: 31 private:
30 // Callback which handles returning the executable and profile paths to the 32 // Callback which handles returning the executable and profile paths to the
31 // front end. 33 // front end.
32 void OnGotFilePaths(base::string16* executable_path_data, 34 void OnGotFilePaths(base::string16* executable_path_data,
33 base::string16* profile_path_data); 35 base::string16* profile_path_data,
36 const GetFilePathsCallback& callback);
34 37
38 #if defined(ENABLE_PLUGINS)
35 // Callback for GetPlugins which responds to the page with the Flash version. 39 // Callback for GetPlugins which responds to the page with the Flash version.
36 // This also initiates the OS Version load on ChromeOS. 40 void OnGotPlugins(const GetFlashVersionCallback& callback,
37 void OnGotPlugins(const std::vector<content::WebPluginInfo>& plugins); 41 const std::vector<content::WebPluginInfo>& plugins);
42 #endif // defined(ENABLE_PLUGINS)
43 #if defined(OS_CHROMEOS)
44 void OnGotOsVersion(const GetOsVersionCallback& callback,
45 const std::string& version);
46 #endif // defined(OS_CHROMEOS)
47
48 content::WebUI* web_ui_;
49 mojo::StrongBinding<VersionHandlerMojo> binding_;
sky 2015/12/10 16:20:34 Normally MojoWebUIHandler is owned by content. Str
dpapad 2015/12/10 18:40:19 Done.
38 50
39 // Factory for the creating refs in callbacks. 51 // Factory for the creating refs in callbacks.
40 base::WeakPtrFactory<VersionHandler> weak_ptr_factory_; 52 base::WeakPtrFactory<VersionHandler> weak_ptr_factory_;
41 53
42 DISALLOW_COPY_AND_ASSIGN(VersionHandler); 54 DISALLOW_COPY_AND_ASSIGN(VersionHandler);
43 }; 55 };
44 56
45 #endif // CHROME_BROWSER_UI_WEBUI_VERSION_HANDLER_H_ 57 #endif // CHROME_BROWSER_UI_WEBUI_VERSION_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/version.mojom ('k') | chrome/browser/ui/webui/version_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698