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 <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/display/display_layout_store.h" | 8 #include "ash/display/display_layout_store.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "ui/gfx/display.h" | 11 #include "ui/gfx/display.h" |
12 | 12 |
13 namespace ash { | 13 namespace ash { |
14 | 14 |
15 DisplayLayoutStore::DisplayLayoutStore() { | 15 DisplayLayoutStore::DisplayLayoutStore() { |
16 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 16 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
17 if (command_line->HasSwitch(switches::kAshSecondaryDisplayLayout)) { | 17 if (command_line->HasSwitch(switches::kAshSecondaryDisplayLayout)) { |
18 std::string value = command_line->GetSwitchValueASCII( | 18 std::string value = command_line->GetSwitchValueASCII( |
19 switches::kAshSecondaryDisplayLayout); | 19 switches::kAshSecondaryDisplayLayout); |
20 char layout; | 20 char layout; |
21 int offset = 0; | 21 int offset = 0; |
22 if (sscanf(value.c_str(), "%c,%d", &layout, &offset) == 2) { | 22 if (sscanf(value.c_str(), "%c,%d", &layout, &offset) == 2) { |
23 if (layout == 't') | 23 if (layout == 't') |
24 default_display_layout_.position = DisplayLayout::TOP; | 24 default_display_layout_.position = DisplayLayout::TOP; |
25 else if (layout == 'b') | 25 else if (layout == 'b') |
26 default_display_layout_.position = DisplayLayout::BOTTOM; | 26 default_display_layout_.position = DisplayLayout::BOTTOM; |
27 else if (layout == 'r') | 27 else if (layout == 'r') |
28 default_display_layout_.position = DisplayLayout::RIGHT; | 28 default_display_layout_.position = DisplayLayout::RIGHT; |
29 else if (layout == 'l') | 29 else if (layout == 'l') |
30 default_display_layout_.position = DisplayLayout::LEFT; | 30 default_display_layout_.position = DisplayLayout::LEFT; |
31 default_display_layout_.offset = offset; | 31 default_display_layout_.offset = offset; |
32 } | 32 } |
33 } | 33 } |
34 } | 34 } |
35 | 35 |
36 DisplayLayoutStore::~DisplayLayoutStore() { | 36 DisplayLayoutStore::~DisplayLayoutStore() { |
37 } | 37 } |
38 | 38 |
39 void DisplayLayoutStore::SetDefaultDisplayLayout(const DisplayLayout& layout) { | 39 void DisplayLayoutStore::SetDefaultDisplayLayout(const DisplayLayout& layout) { |
40 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 40 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
41 if (!command_line->HasSwitch(switches::kAshSecondaryDisplayLayout)) | 41 if (!command_line->HasSwitch(switches::kAshSecondaryDisplayLayout)) |
42 default_display_layout_ = layout; | 42 default_display_layout_ = layout; |
43 } | 43 } |
44 | 44 |
45 void DisplayLayoutStore::RegisterLayoutForDisplayIdPair( | 45 void DisplayLayoutStore::RegisterLayoutForDisplayIdPair( |
46 int64 id1, | 46 int64 id1, |
47 int64 id2, | 47 int64 id2, |
48 const DisplayLayout& layout) { | 48 const DisplayLayout& layout) { |
49 paired_layouts_[std::make_pair(id1, id2)] = layout; | 49 paired_layouts_[std::make_pair(id1, id2)] = layout; |
50 } | 50 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 DisplayLayout DisplayLayoutStore::CreateDisplayLayout( | 84 DisplayLayout DisplayLayoutStore::CreateDisplayLayout( |
85 const DisplayIdPair& pair) { | 85 const DisplayIdPair& pair) { |
86 DisplayLayout layout = default_display_layout_; | 86 DisplayLayout layout = default_display_layout_; |
87 layout.primary_id = pair.first; | 87 layout.primary_id = pair.first; |
88 paired_layouts_[pair] = layout; | 88 paired_layouts_[pair] = layout; |
89 return layout; | 89 return layout; |
90 } | 90 } |
91 | 91 |
92 } // namespace ash | 92 } // namespace ash |
OLD | NEW |