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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/base_webui_handler.h

Issue 2766393003: cros: Defer lockscreen updateUserImage and loadUser calls. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chromeos/login/signin_screen_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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_CHROMEOS_LOGIN_BASE_WEBUI_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_WEBUI_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_WEBUI_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_WEBUI_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 22 matching lines...) Expand all
33 class OobeUI; 33 class OobeUI;
34 34
35 // A helper class to store deferred Javascript calls, shared by subclasses of 35 // A helper class to store deferred Javascript calls, shared by subclasses of
36 // BaseWebUIHandler. 36 // BaseWebUIHandler.
37 class JSCallsContainer { 37 class JSCallsContainer {
38 public: 38 public:
39 JSCallsContainer(); 39 JSCallsContainer();
40 ~JSCallsContainer(); 40 ~JSCallsContainer();
41 41
42 // Used to decide whether the JS call should be deferred. 42 // Used to decide whether the JS call should be deferred.
43 bool is_initialized() { return is_initialized_; } 43 bool is_initialized() const { return is_initialized_; }
44 44
45 // Used to mark the instance as intialized. 45 // Used to mark the instance as intialized.
46 void mark_initialized() { is_initialized_ = true; } 46 void mark_initialized() { is_initialized_ = true; }
47 47
48 // Used to add deferred calls to. 48 // Used to add deferred calls to.
49 std::vector<base::Closure>& deferred_js_calls() { return deferred_js_calls_; } 49 std::vector<base::Closure>& deferred_js_calls() { return deferred_js_calls_; }
50 50
51 private: 51 private:
52 // Whether the instance is initialized. 52 // Whether the instance is initialized.
53 // 53 //
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 OobeScreen GetCurrentScreen() const; 218 OobeScreen GetCurrentScreen() const;
219 219
220 // Whether page is ready. 220 // Whether page is ready.
221 bool page_is_ready() const { return page_is_ready_; } 221 bool page_is_ready() const { return page_is_ready_; }
222 222
223 // Returns the window which shows us. 223 // Returns the window which shows us.
224 virtual gfx::NativeWindow GetNativeWindow(); 224 virtual gfx::NativeWindow GetNativeWindow();
225 225
226 void SetBaseScreen(BaseScreen* base_screen); 226 void SetBaseScreen(BaseScreen* base_screen);
227 227
228 // Returns true if JS side has sent a screenStateInitialize event.
229 // TODO(jdufault): Remove after resolving crbug.com/699798
230 bool is_js_initialized_and_ready() const {
231 return js_calls_container_->is_initialized();
232 }
233
228 private: 234 private:
229 // Calls Javascript method. 235 // Calls Javascript method.
230 // 236 //
231 // Note that the Args template parameter pack should consist of types 237 // Note that the Args template parameter pack should consist of types
232 // convertible to base::Value. 238 // convertible to base::Value.
233 template <typename... Args> 239 template <typename... Args>
234 void ExecuteDeferredJSCall(const std::string& function_name, 240 void ExecuteDeferredJSCall(const std::string& function_name,
235 std::unique_ptr<Args>... args) { 241 std::unique_ptr<Args>... args) {
236 CallJS(function_name, *args...); 242 CallJS(function_name, *args...);
237 } 243 }
(...skipping 27 matching lines...) Expand all
265 base::DictionaryValue pending_context_changes_; 271 base::DictionaryValue pending_context_changes_;
266 272
267 JSCallsContainer* js_calls_container_ = nullptr; // non-owning pointers. 273 JSCallsContainer* js_calls_container_ = nullptr; // non-owning pointers.
268 274
269 DISALLOW_COPY_AND_ASSIGN(BaseWebUIHandler); 275 DISALLOW_COPY_AND_ASSIGN(BaseWebUIHandler);
270 }; 276 };
271 277
272 } // namespace chromeos 278 } // namespace chromeos
273 279
274 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_WEBUI_HANDLER_H_ 280 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_WEBUI_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698