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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.cc

Issue 2701023003: cros: Move call js prefix out of ctor. (Closed)
Patch Set: Created 3 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "chrome/browser/chromeos/login/oobe_screen.h" 9 #include "chrome/browser/chromeos/login/oobe_screen.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
11 #include "chromeos/chromeos_switches.h" 11 #include "chromeos/chromeos_switches.h"
12 #include "components/login/localized_values_builder.h" 12 #include "components/login/localized_values_builder.h"
13 13
14 namespace chromeos { 14 namespace chromeos {
15 15
16 namespace { 16 namespace {
17 17
18 const char kJsScreenPath[] = "login.HostPairingScreen"; 18 const char kJsScreenPath[] = "login.HostPairingScreen";
19 19
20 const char kMethodContextChanged[] = "contextChanged"; 20 const char kMethodContextChanged[] = "contextChanged";
21 21
22 // Sent from JS when screen is ready to receive context updates. 22 // Sent from JS when screen is ready to receive context updates.
23 // TODO(dzhioev): Move 'contextReady' logic to the base screen handler when 23 // TODO(dzhioev): Move 'contextReady' logic to the base screen handler when
24 // all screens migrate to context-based communications. 24 // all screens migrate to context-based communications.
25 const char kCallbackContextReady[] = "contextReady"; 25 const char kCallbackContextReady[] = "contextReady";
26 26
27 } // namespace 27 } // namespace
28 28
29 HostPairingScreenHandler::HostPairingScreenHandler() 29 HostPairingScreenHandler::HostPairingScreenHandler() {
30 : BaseScreenHandler(kJsScreenPath), 30 set_call_js_prefix(kJsScreenPath);
31 delegate_(NULL),
32 show_on_init_(false),
33 js_context_ready_(false) {
34 } 31 }
35 32
36 HostPairingScreenHandler::~HostPairingScreenHandler() { 33 HostPairingScreenHandler::~HostPairingScreenHandler() {
37 if (delegate_) 34 if (delegate_)
38 delegate_->OnActorDestroyed(this); 35 delegate_->OnActorDestroyed(this);
39 } 36 }
40 37
41 void HostPairingScreenHandler::HandleContextReady() { 38 void HostPairingScreenHandler::HandleContextReady() {
42 js_context_ready_ = true; 39 js_context_ready_ = true;
43 OnContextChanged(context_cache_.storage()); 40 OnContextChanged(context_cache_.storage());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 void HostPairingScreenHandler::OnContextChanged( 110 void HostPairingScreenHandler::OnContextChanged(
114 const base::DictionaryValue& diff) { 111 const base::DictionaryValue& diff) {
115 if (!js_context_ready_) { 112 if (!js_context_ready_) {
116 context_cache_.ApplyChanges(diff, NULL); 113 context_cache_.ApplyChanges(diff, NULL);
117 return; 114 return;
118 } 115 }
119 CallJS(kMethodContextChanged, diff); 116 CallJS(kMethodContextChanged, diff);
120 } 117 }
121 118
122 } // namespace chromeos 119 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698