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), base::Value(y), |
30 base::FundamentalValue(y), base::FundamentalValue(width), | 30 base::Value(width), base::Value(height)); |
31 base::FundamentalValue(height)); | |
32 } | 31 } |
33 | 32 |
34 void FirstRunHandler::AddRoundHole(int x, int y, float radius) { | 33 void FirstRunHandler::AddRoundHole(int x, int y, float radius) { |
35 web_ui()->CallJavascriptFunctionUnsafe( | 34 web_ui()->CallJavascriptFunctionUnsafe("cr.FirstRun.addRoundHole", |
36 "cr.FirstRun.addRoundHole", base::FundamentalValue(x), | 35 base::Value(x), base::Value(y), |
37 base::FundamentalValue(y), base::FundamentalValue(radius)); | 36 base::Value(radius)); |
38 } | 37 } |
39 | 38 |
40 void FirstRunHandler::RemoveBackgroundHoles() { | 39 void FirstRunHandler::RemoveBackgroundHoles() { |
41 web_ui()->CallJavascriptFunctionUnsafe("cr.FirstRun.removeHoles"); | 40 web_ui()->CallJavascriptFunctionUnsafe("cr.FirstRun.removeHoles"); |
42 } | 41 } |
43 | 42 |
44 void FirstRunHandler::ShowStepPositioned(const std::string& name, | 43 void FirstRunHandler::ShowStepPositioned(const std::string& name, |
45 const StepPosition& position) { | 44 const StepPosition& position) { |
46 web_ui()->CallJavascriptFunctionUnsafe( | 45 web_ui()->CallJavascriptFunctionUnsafe( |
47 "cr.FirstRun.showStep", base::StringValue(name), *position.AsValue()); | 46 "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); | 125 delegate()->OnStepHidden(step_name); |
127 } | 126 } |
128 | 127 |
129 void FirstRunHandler::HandleFinalized(const base::ListValue* args) { | 128 void FirstRunHandler::HandleFinalized(const base::ListValue* args) { |
130 is_finalizing_ = false; | 129 is_finalizing_ = false; |
131 if (delegate()) | 130 if (delegate()) |
132 delegate()->OnActorFinalized(); | 131 delegate()->OnActorFinalized(); |
133 } | 132 } |
134 | 133 |
135 } // namespace chromeos | 134 } // namespace chromeos |
OLD | NEW |