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_actor.h" | 5 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_actor.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
| 9 #include "base/memory/ptr_util.h" |
9 #include "base/values.h" | 10 #include "base/values.h" |
10 | 11 |
11 namespace { | 12 namespace { |
12 const int kNoneValue = std::numeric_limits<int>::min(); | 13 const int kNoneValue = std::numeric_limits<int>::min(); |
13 } | 14 } |
14 | 15 |
15 namespace chromeos { | 16 namespace chromeos { |
16 | 17 |
17 FirstRunActor::StepPosition::StepPosition() | 18 FirstRunActor::StepPosition::StepPosition() |
18 : top_(kNoneValue), | 19 : top_(kNoneValue), |
(...skipping 16 matching lines...) Expand all Loading... |
35 FirstRunActor::StepPosition::SetBottom(int bottom) { | 36 FirstRunActor::StepPosition::SetBottom(int bottom) { |
36 bottom_ = bottom; | 37 bottom_ = bottom; |
37 return *this; | 38 return *this; |
38 } | 39 } |
39 | 40 |
40 FirstRunActor::StepPosition& FirstRunActor::StepPosition::SetLeft(int left) { | 41 FirstRunActor::StepPosition& FirstRunActor::StepPosition::SetLeft(int left) { |
41 left_ = left; | 42 left_ = left; |
42 return *this; | 43 return *this; |
43 } | 44 } |
44 | 45 |
45 scoped_ptr<base::DictionaryValue> FirstRunActor::StepPosition::AsValue() const { | 46 std::unique_ptr<base::DictionaryValue> FirstRunActor::StepPosition::AsValue() |
| 47 const { |
46 base::DictionaryValue* result = new base::DictionaryValue(); | 48 base::DictionaryValue* result = new base::DictionaryValue(); |
47 if (top_ != kNoneValue) | 49 if (top_ != kNoneValue) |
48 result->SetInteger("top", top_); | 50 result->SetInteger("top", top_); |
49 if (right_ != kNoneValue) | 51 if (right_ != kNoneValue) |
50 result->SetInteger("right", right_); | 52 result->SetInteger("right", right_); |
51 if (bottom_ != kNoneValue) | 53 if (bottom_ != kNoneValue) |
52 result->SetInteger("bottom", bottom_); | 54 result->SetInteger("bottom", bottom_); |
53 if (left_ != kNoneValue) | 55 if (left_ != kNoneValue) |
54 result->SetInteger("left", left_); | 56 result->SetInteger("left", left_); |
55 return make_scoped_ptr(result); | 57 return base::WrapUnique(result); |
56 } | 58 } |
57 | 59 |
58 FirstRunActor::FirstRunActor() | 60 FirstRunActor::FirstRunActor() |
59 : delegate_(NULL) { | 61 : delegate_(NULL) { |
60 } | 62 } |
61 | 63 |
62 FirstRunActor::~FirstRunActor() { | 64 FirstRunActor::~FirstRunActor() { |
63 if (delegate()) | 65 if (delegate()) |
64 delegate()->OnActorDestroyed(); | 66 delegate()->OnActorDestroyed(); |
65 delegate_ = NULL; | 67 delegate_ = NULL; |
66 } | 68 } |
67 | 69 |
68 } // namespace chromeos | 70 } // namespace chromeos |
69 | 71 |
OLD | NEW |