OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ash/display/display_layout.h" | 5 #include "ash/display/display_layout.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/display/display_pref_util.h" | 9 #include "ash/display/display_pref_util.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 LOG(ERROR) << "Invalid position value:" << position; | 48 LOG(ERROR) << "Invalid position value:" << position; |
49 return false; | 49 return false; |
50 } | 50 } |
51 | 51 |
52 std::string GetStringFromPosition(DisplayLayout::Position position) { | 52 std::string GetStringFromPosition(DisplayLayout::Position position) { |
53 const PositionToStringMap* map = GetPositionToStringMap(); | 53 const PositionToStringMap* map = GetPositionToStringMap(); |
54 PositionToStringMap::const_iterator iter = map->find(position); | 54 PositionToStringMap::const_iterator iter = map->find(position); |
55 return iter != map->end() ? iter->second : std::string("unknown"); | 55 return iter != map->end() ? iter->second : std::string("unknown"); |
56 } | 56 } |
57 | 57 |
58 bool GetDisplayIdFromString(const base::StringPiece& position, int64* field) { | 58 bool GetDisplayIdFromString(const base::StringPiece& position, int64_t* field) { |
59 return base::StringToInt64(position, field); | 59 return base::StringToInt64(position, field); |
60 } | 60 } |
61 | 61 |
62 } // namespace | 62 } // namespace |
63 | 63 |
64 //////////////////////////////////////////////////////////////////////////////// | 64 //////////////////////////////////////////////////////////////////////////////// |
65 // DisplayLayout | 65 // DisplayLayout |
66 | 66 |
67 // static | 67 // static |
68 DisplayLayout DisplayLayout::FromInts(int position, int offsets) { | 68 DisplayLayout DisplayLayout::FromInts(int position, int offsets) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 // static | 160 // static |
161 void DisplayLayout::RegisterJSONConverter( | 161 void DisplayLayout::RegisterJSONConverter( |
162 base::JSONValueConverter<DisplayLayout>* converter) { | 162 base::JSONValueConverter<DisplayLayout>* converter) { |
163 converter->RegisterCustomField<Position>( | 163 converter->RegisterCustomField<Position>( |
164 kPositionKey, &DisplayLayout::position, &GetPositionFromString); | 164 kPositionKey, &DisplayLayout::position, &GetPositionFromString); |
165 converter->RegisterIntField(kOffsetKey, &DisplayLayout::offset); | 165 converter->RegisterIntField(kOffsetKey, &DisplayLayout::offset); |
166 converter->RegisterBoolField(kMirroredKey, &DisplayLayout::mirrored); | 166 converter->RegisterBoolField(kMirroredKey, &DisplayLayout::mirrored); |
167 converter->RegisterBoolField(kDefaultUnifiedKey, | 167 converter->RegisterBoolField(kDefaultUnifiedKey, |
168 &DisplayLayout::default_unified); | 168 &DisplayLayout::default_unified); |
169 converter->RegisterCustomField<int64>( | 169 converter->RegisterCustomField<int64_t>( |
170 kPrimaryIdKey, &DisplayLayout::primary_id, &GetDisplayIdFromString); | 170 kPrimaryIdKey, &DisplayLayout::primary_id, &GetDisplayIdFromString); |
171 } | 171 } |
172 | 172 |
173 } // namespace ash | 173 } // namespace ash |
OLD | NEW |