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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/display_options_handler.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
« no previous file with comments | « chrome/browser/chromeos/display/display_preferences.cc ('k') | ui/aura/display_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/webui/options/chromeos/display_options_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/display_options_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/display/display_controller.h" 9 #include "ash/display/display_controller.h"
10 #include "ash/display/output_configurator_animation.h" 10 #include "ash/display/output_configurator_animation.h"
11 #include "ash/screen_ash.h"
11 #include "ash/shell.h" 12 #include "ash/shell.h"
12 #include "base/bind.h" 13 #include "base/bind.h"
13 #include "base/json/json_value_converter.h" 14 #include "base/json/json_value_converter.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
16 #include "base/values.h" 17 #include "base/values.h"
17 #include "chrome/browser/chromeos/display/display_preferences.h" 18 #include "chrome/browser/chromeos/display/display_preferences.h"
18 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
20 #include "chromeos/display/output_configurator.h" 21 #include "chromeos/display/output_configurator.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 base::ListValue displays; 112 base::ListValue displays;
112 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { 113 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) {
113 const gfx::Display* display = display_manager->GetDisplayAt(i); 114 const gfx::Display* display = display_manager->GetDisplayAt(i);
114 const gfx::Rect& bounds = display->bounds(); 115 const gfx::Rect& bounds = display->bounds();
115 base::DictionaryValue* js_display = new base::DictionaryValue(); 116 base::DictionaryValue* js_display = new base::DictionaryValue();
116 js_display->SetDouble("id", display->id()); 117 js_display->SetDouble("id", display->id());
117 js_display->SetDouble("x", bounds.x()); 118 js_display->SetDouble("x", bounds.x());
118 js_display->SetDouble("y", bounds.y()); 119 js_display->SetDouble("y", bounds.y());
119 js_display->SetDouble("width", bounds.width()); 120 js_display->SetDouble("width", bounds.width());
120 js_display->SetDouble("height", bounds.height()); 121 js_display->SetDouble("height", bounds.height());
121 js_display->SetString("name", display_manager->GetDisplayNameAt(i)); 122 js_display->SetString("name",
123 display_manager->GetDisplayNameFor(*display));
122 displays.Set(i, js_display); 124 displays.Set(i, js_display);
123 } 125 }
124 126
125 scoped_ptr<base::Value> layout_value(base::Value::CreateNullValue()); 127 scoped_ptr<base::Value> layout_value(base::Value::CreateNullValue());
126 scoped_ptr<base::Value> offset_value(base::Value::CreateNullValue()); 128 scoped_ptr<base::Value> offset_value(base::Value::CreateNullValue());
127 if (display_manager->GetNumDisplays() > 1) { 129 if (display_manager->GetNumDisplays() > 1) {
128 const std::string& secondary_display_name = 130 const gfx::Display secondary_display =
129 display_manager->GetDisplayNameAt(1); 131 ash::ScreenAsh::GetSecondaryDisplay();
130 const ash::DisplayLayout& layout = 132 const ash::DisplayLayout& layout =
131 display_controller->GetLayoutForDisplayName(secondary_display_name); 133 display_controller->GetLayoutForDisplay(secondary_display);
132 layout_value.reset(new base::FundamentalValue(layout.position)); 134 layout_value.reset(new base::FundamentalValue(layout.position));
133 offset_value.reset(new base::FundamentalValue(layout.offset)); 135 offset_value.reset(new base::FundamentalValue(layout.offset));
134 } 136 }
135 137
136 web_ui()->CallJavascriptFunction( 138 web_ui()->CallJavascriptFunction(
137 "options.DisplayOptions.setDisplayInfo", 139 "options.DisplayOptions.setDisplayInfo",
138 mirroring, displays, *layout_value.get(), *offset_value.get()); 140 mirroring, displays, *layout_value.get(), *offset_value.get());
139 } 141 }
140 142
141 void DisplayOptionsHandler::FadeOutForMirroringFinished(bool is_mirroring) { 143 void DisplayOptionsHandler::FadeOutForMirroringFinished(bool is_mirroring) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 ash::Shell::GetInstance()->output_configurator_animation()-> 196 ash::Shell::GetInstance()->output_configurator_animation()->
195 StartFadeOutAnimation(base::Bind( 197 StartFadeOutAnimation(base::Bind(
196 &DisplayOptionsHandler::FadeOutForDisplayLayoutFinished, 198 &DisplayOptionsHandler::FadeOutForDisplayLayoutFinished,
197 base::Unretained(this), 199 base::Unretained(this),
198 static_cast<int>(layout), 200 static_cast<int>(layout),
199 static_cast<int>(offset))); 201 static_cast<int>(offset)));
200 } 202 }
201 203
202 } // namespace options 204 } // namespace options
203 } // namespace chromeos 205 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/display/display_preferences.cc ('k') | ui/aura/display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698