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
3// found in the LICENSE file.
4
5#include "chrome/browser/ui/webui/chromeos/first_run/first_run_actor.h"
6
7#include <limits>
8
9#include "base/values.h"
10
11namespace {
12const int kNoneValue = std::numeric_limits<int>::min();
13}
14
15namespace chromeos {
16
17FirstRunActor::StepPosition::StepPosition()
18    : top_(kNoneValue),
19      right_(kNoneValue),
20      bottom_(kNoneValue),
21      left_(kNoneValue) {
22}
23
24FirstRunActor::StepPosition& FirstRunActor::StepPosition::SetTop(int top) {
25  top_ = top;
26  return *this;
27}
28
29FirstRunActor::StepPosition& FirstRunActor::StepPosition::SetRight(int right) {
30  right_ = right;
31  return *this;
32}
33
34FirstRunActor::StepPosition&
35FirstRunActor::StepPosition::SetBottom(int bottom) {
36  bottom_ = bottom;
37  return *this;
38}
39
40FirstRunActor::StepPosition& FirstRunActor::StepPosition::SetLeft(int left) {
41  left_ = left;
42  return *this;
43}
44
45scoped_ptr<base::DictionaryValue> FirstRunActor::StepPosition::AsValue() const {
46  base::DictionaryValue* result = new base::DictionaryValue();
47  if (top_ != kNoneValue)
48    result->SetInteger("top", top_);
49  if (right_ != kNoneValue)
50    result->SetInteger("right", right_);
51  if (bottom_ != kNoneValue)
52    result->SetInteger("bottom", bottom_);
53  if (left_ != kNoneValue)
54    result->SetInteger("left", left_);
55  return make_scoped_ptr(result);
56}
57
58FirstRunActor::FirstRunActor()
59    : delegate_(NULL) {
60}
61
62FirstRunActor::~FirstRunActor() {
63  if (delegate())
64    delegate()->OnActorDestroyed();
65  delegate_ = NULL;
66}
67
68}  // namespace chromeos
69
70