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

Unified Diff: chrome/browser/ui/webui/welcome_win10_handler.h

Issue 2449853008: Determine the Win10-specific Welcome page variant to display (Closed)
Patch Set: More nits Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/startup/startup_features.cc ('k') | chrome/browser/ui/webui/welcome_win10_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/welcome_win10_handler.h
diff --git a/chrome/browser/ui/webui/welcome_win10_handler.h b/chrome/browser/ui/webui/welcome_win10_handler.h
index 990e819de9dbf15529af1c9876514611f4a39e8e..aafbf863d00fe749fcf6c292dc780d884b724537 100644
--- a/chrome/browser/ui/webui/welcome_win10_handler.h
+++ b/chrome/browser/ui/webui/welcome_win10_handler.h
@@ -5,7 +5,14 @@
#ifndef CHROME_BROWSER_UI_WEBUI_WELCOME_WIN10_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_WELCOME_WIN10_HANDLER_H_
+#include <memory>
+#include <string>
+
#include "base/macros.h"
+#include "base/optional.h"
+#include "base/timer/timer.h"
+#include "chrome/common/shell_handler_win.mojom.h"
+#include "content/public/browser/utility_process_mojo_client.h"
#include "content/public/browser/web_ui_message_handler.h"
namespace base {
@@ -22,9 +29,39 @@ class WelcomeWin10Handler : public content::WebUIMessageHandler {
void RegisterMessages() override;
private:
+ // Handlers for javascript calls.
+ void HandleGetPinnedToTaskbarState(const base::ListValue* args);
void HandleSetDefaultBrowser(const base::ListValue* args);
void HandleContinue(const base::ListValue* args);
+ void StartIsPinnedToTaskbarCheck();
+
+ // Callback for mojom::ShellHandler's call to IsPinnedToTaskbar().
+ void OnIsPinnedToTaskbarResult(bool succeeded, bool is_pinned_to_taskbar);
+
+ // Sets the internal result and optionally call
+ // SendPinnedToTaskbarStateResult() in the case that
+ // |pinned_state_callback_id_| is not empty.
+ void OnIsPinnedToTaskbarDetermined(bool is_pinned_to_taskbar);
+
+ // Returns the result to the getPinnedToTaskbarState() javascript call via the
+ // promise.
+ void SendPinnedToTaskbarStateResult();
+
+ std::unique_ptr<content::UtilityProcessMojoClient<mojom::ShellHandler>>
+ client_;
+ base::OneShotTimer timer_;
+
+ // Acts as a cache to hold the taskbar pinned state of Chrome. It has no value
+ // until this state is determined.
+ base::Optional<bool> pinned_state_result_;
+
+ // The callback id used to return the result to the getPinnedToTaskbarState()
+ // javascript call. This id is empty until we receive the call; thus this
+ // variable is used to determine if the result should be sent to the caller
+ // when it is received, or wait for the call to happen.
+ std::string pinned_state_callback_id_;
+
DISALLOW_COPY_AND_ASSIGN(WelcomeWin10Handler);
};
« no previous file with comments | « chrome/browser/ui/startup/startup_features.cc ('k') | chrome/browser/ui/webui/welcome_win10_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698