Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Side by Side Diff: chrome/browser/chromeos/display/display_preferences.cc

Issue 10905288: Switch primary display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/display/display_preferences.h" 5 #include "chrome/browser/chromeos/display/display_preferences.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 int layout, 60 int layout,
61 int offset) { 61 int offset) {
62 { 62 {
63 DictionaryPrefUpdate update(pref_service, prefs::kSecondaryDisplays); 63 DictionaryPrefUpdate update(pref_service, prefs::kSecondaryDisplays);
64 ash::DisplayLayout display_layout( 64 ash::DisplayLayout display_layout(
65 static_cast<ash::DisplayLayout::Position>(layout), offset); 65 static_cast<ash::DisplayLayout::Position>(layout), offset);
66 66
67 aura::DisplayManager* display_manager = 67 aura::DisplayManager* display_manager =
68 aura::Env::GetInstance()->display_manager(); 68 aura::Env::GetInstance()->display_manager();
69 std::string name; 69 std::string name;
70 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { 70 EscapeDisplayName(display_manager->GetDisplayNameFor(display),
71 if (display_manager->GetDisplayAt(i)->id() == display.id()) { 71 &name);
72 EscapeDisplayName(display_manager->GetDisplayNameAt(i), &name);
73 break;
74 }
75 }
76
77 DCHECK(!name.empty()); 72 DCHECK(!name.empty());
78 73
79 base::DictionaryValue* pref_data = update.Get(); 74 base::DictionaryValue* pref_data = update.Get();
80 scoped_ptr<base::Value>layout_value(new base::DictionaryValue()); 75 scoped_ptr<base::Value>layout_value(new base::DictionaryValue());
81 if (pref_data->HasKey(name)) { 76 if (pref_data->HasKey(name)) {
82 base::Value* value = NULL; 77 base::Value* value = NULL;
83 if (pref_data->Get(name, &value) && value != NULL) 78 if (pref_data->Get(name, &value) && value != NULL)
84 layout_value.reset(value->DeepCopy()); 79 layout_value.reset(value->DeepCopy());
85 } 80 }
86 if (ash::DisplayLayout::ConvertToValue(display_layout, layout_value.get())) 81 if (ash::DisplayLayout::ConvertToValue(display_layout, layout_value.get()))
(...skipping 27 matching lines...) Expand all
114 ash::DisplayLayout layout; 109 ash::DisplayLayout layout;
115 if (!ash::DisplayLayout::ConvertFromValue(*value, &layout)) 110 if (!ash::DisplayLayout::ConvertFromValue(*value, &layout))
116 continue; 111 continue;
117 112
118 display_controller->SetLayoutForDisplayName( 113 display_controller->SetLayoutForDisplayName(
119 UnescapeDisplayName(*it), layout); 114 UnescapeDisplayName(*it), layout);
120 } 115 }
121 } 116 }
122 117
123 } // namespace chromeos 118 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/wm/system_gesture_event_filter_unittest.cc ('k') | chrome/browser/ui/webui/options/chromeos/display_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698