| OLD | NEW |
| 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 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 9 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 10 #include "content/public/browser/web_ui.h" | 10 #include "content/public/browser/web_ui.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 Initialize(); | 79 Initialize(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void BaseScreenHandler::GetLocalizedStrings(base::DictionaryValue* dict) { | 82 void BaseScreenHandler::GetLocalizedStrings(base::DictionaryValue* dict) { |
| 83 scoped_ptr<LocalizedValuesBuilder> builder(new LocalizedValuesBuilder(dict)); | 83 scoped_ptr<LocalizedValuesBuilder> builder(new LocalizedValuesBuilder(dict)); |
| 84 DeclareLocalizedValues(builder.get()); | 84 DeclareLocalizedValues(builder.get()); |
| 85 GetAdditionalParameters(dict); | 85 GetAdditionalParameters(dict); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void BaseScreenHandler::RegisterMessages() { | 88 void BaseScreenHandler::RegisterMessages() { |
| 89 AddPrefixedCallback("userActed", |
| 90 &BaseScreenHandler::HandleUserAction); |
| 89 AddPrefixedCallback("contextChanged", | 91 AddPrefixedCallback("contextChanged", |
| 90 &BaseScreenHandler::HandleContextChanged); | 92 &BaseScreenHandler::HandleContextChanged); |
| 91 DeclareJSCallbacks(); | 93 DeclareJSCallbacks(); |
| 92 } | 94 } |
| 93 | 95 |
| 94 void BaseScreenHandler::GetAdditionalParameters(base::DictionaryValue* dict) { | 96 void BaseScreenHandler::GetAdditionalParameters(base::DictionaryValue* dict) { |
| 95 } | 97 } |
| 96 | 98 |
| 97 void BaseScreenHandler::CallJS(const std::string& method) { | 99 void BaseScreenHandler::CallJS(const std::string& method) { |
| 98 web_ui()->CallJavascriptFunction(FullMethodPath(method)); | 100 web_ui()->CallJavascriptFunction(FullMethodPath(method)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 111 | 113 |
| 112 gfx::NativeWindow BaseScreenHandler::GetNativeWindow() { | 114 gfx::NativeWindow BaseScreenHandler::GetNativeWindow() { |
| 113 return LoginDisplayHostImpl::default_host()->GetNativeWindow(); | 115 return LoginDisplayHostImpl::default_host()->GetNativeWindow(); |
| 114 } | 116 } |
| 115 | 117 |
| 116 std::string BaseScreenHandler::FullMethodPath(const std::string& method) const { | 118 std::string BaseScreenHandler::FullMethodPath(const std::string& method) const { |
| 117 DCHECK(!method.empty()); | 119 DCHECK(!method.empty()); |
| 118 return js_screen_path_prefix_ + method; | 120 return js_screen_path_prefix_ + method; |
| 119 } | 121 } |
| 120 | 122 |
| 123 void BaseScreenHandler::HandleUserAction(const std::string& action_id) { |
| 124 if (base_screen_) |
| 125 base_screen_->OnUserAction(action_id); |
| 126 } |
| 127 |
| 121 void BaseScreenHandler::HandleContextChanged( | 128 void BaseScreenHandler::HandleContextChanged( |
| 122 const base::DictionaryValue* diff) { | 129 const base::DictionaryValue* diff) { |
| 123 if (diff && base_screen_) | 130 if (diff && base_screen_) |
| 124 base_screen_->OnContextChanged(*diff); | 131 base_screen_->OnContextChanged(*diff); |
| 125 } | 132 } |
| 126 | 133 |
| 127 } // namespace chromeos | 134 } // namespace chromeos |
| OLD | NEW |