| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/first_run/first_run_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "content/public/browser/web_ui.h" | 9 #include "content/public/browser/web_ui.h" |
| 10 | 10 |
| 11 namespace chromeos { | 11 namespace chromeos { |
| 12 | 12 |
| 13 FirstRunHandler::FirstRunHandler() | 13 FirstRunHandler::FirstRunHandler() |
| 14 : is_initialized_(false), | 14 : is_initialized_(false), |
| 15 is_finalizing_(false) { | 15 is_finalizing_(false) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 bool FirstRunHandler::IsInitialized() { | 18 bool FirstRunHandler::IsInitialized() { |
| 19 return is_initialized_; | 19 return is_initialized_; |
| 20 } | 20 } |
| 21 | 21 |
| 22 void FirstRunHandler::SetBackgroundVisible(bool visible) { | 22 void FirstRunHandler::SetBackgroundVisible(bool visible) { |
| 23 web_ui()->CallJavascriptFunctionUnsafe("cr.FirstRun.setBackgroundVisible", | 23 web_ui()->CallJavascriptFunctionUnsafe("cr.FirstRun.setBackgroundVisible", |
| 24 base::FundamentalValue(visible)); | 24 base::Value(visible)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void FirstRunHandler::AddRectangularHole(int x, int y, int width, int height) { | 27 void FirstRunHandler::AddRectangularHole(int x, int y, int width, int height) { |
| 28 web_ui()->CallJavascriptFunctionUnsafe( | 28 web_ui()->CallJavascriptFunctionUnsafe( |
| 29 "cr.FirstRun.addRectangularHole", base::FundamentalValue(x), | 29 "cr.FirstRun.addRectangularHole", base::Value(x), |
| 30 base::FundamentalValue(y), base::FundamentalValue(width), | 30 base::Value(y), base::Value(width), |
| 31 base::FundamentalValue(height)); | 31 base::Value(height)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void FirstRunHandler::AddRoundHole(int x, int y, float radius) { | 34 void FirstRunHandler::AddRoundHole(int x, int y, float radius) { |
| 35 web_ui()->CallJavascriptFunctionUnsafe( | 35 web_ui()->CallJavascriptFunctionUnsafe( |
| 36 "cr.FirstRun.addRoundHole", base::FundamentalValue(x), | 36 "cr.FirstRun.addRoundHole", base::Value(x), |
| 37 base::FundamentalValue(y), base::FundamentalValue(radius)); | 37 base::Value(y), base::Value(radius)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void FirstRunHandler::RemoveBackgroundHoles() { | 40 void FirstRunHandler::RemoveBackgroundHoles() { |
| 41 web_ui()->CallJavascriptFunctionUnsafe("cr.FirstRun.removeHoles"); | 41 web_ui()->CallJavascriptFunctionUnsafe("cr.FirstRun.removeHoles"); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void FirstRunHandler::ShowStepPositioned(const std::string& name, | 44 void FirstRunHandler::ShowStepPositioned(const std::string& name, |
| 45 const StepPosition& position) { | 45 const StepPosition& position) { |
| 46 web_ui()->CallJavascriptFunctionUnsafe( | 46 web_ui()->CallJavascriptFunctionUnsafe( |
| 47 "cr.FirstRun.showStep", base::StringValue(name), *position.AsValue()); | 47 "cr.FirstRun.showStep", base::StringValue(name), *position.AsValue()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 delegate()->OnStepHidden(step_name); | 126 delegate()->OnStepHidden(step_name); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void FirstRunHandler::HandleFinalized(const base::ListValue* args) { | 129 void FirstRunHandler::HandleFinalized(const base::ListValue* args) { |
| 130 is_finalizing_ = false; | 130 is_finalizing_ = false; |
| 131 if (delegate()) | 131 if (delegate()) |
| 132 delegate()->OnActorFinalized(); | 132 delegate()->OnActorFinalized(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace chromeos | 135 } // namespace chromeos |
| OLD | NEW |