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 "chrome/browser/ui/webui/options/chromeos/display_overscan_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/display_overscan_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/screen_util.h" | 10 #include "ash/screen_util.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 "move", | 75 "move", |
76 base::Bind(&DisplayOverscanHandler::HandleMove, | 76 base::Bind(&DisplayOverscanHandler::HandleMove, |
77 base::Unretained(this))); | 77 base::Unretained(this))); |
78 web_ui()->RegisterMessageCallback( | 78 web_ui()->RegisterMessageCallback( |
79 "resize", | 79 "resize", |
80 base::Bind(&DisplayOverscanHandler::HandleResize, | 80 base::Bind(&DisplayOverscanHandler::HandleResize, |
81 base::Unretained(this))); | 81 base::Unretained(this))); |
82 } | 82 } |
83 | 83 |
84 void DisplayOverscanHandler::OnDisplayAdded(const gfx::Display& new_display) { | 84 void DisplayOverscanHandler::OnDisplayAdded(const gfx::Display& new_display) { |
| 85 if (!overscan_calibrator_) |
| 86 return; |
| 87 |
85 web_ui()->CallJavascriptFunction( | 88 web_ui()->CallJavascriptFunction( |
86 "options.DisplayOverscan.onOverscanCanceled"); | 89 "options.DisplayOverscan.onOverscanCanceled"); |
87 } | 90 } |
88 | 91 |
89 void DisplayOverscanHandler::OnDisplayRemoved(const gfx::Display& old_display) { | 92 void DisplayOverscanHandler::OnDisplayRemoved(const gfx::Display& old_display) { |
| 93 if (!overscan_calibrator_) |
| 94 return; |
| 95 |
90 web_ui()->CallJavascriptFunction( | 96 web_ui()->CallJavascriptFunction( |
91 "options.DisplayOverscan.onOverscanCanceled"); | 97 "options.DisplayOverscan.onOverscanCanceled"); |
92 } | 98 } |
93 | 99 |
94 void DisplayOverscanHandler::OnDisplayMetricsChanged(const gfx::Display&, | 100 void DisplayOverscanHandler::OnDisplayMetricsChanged(const gfx::Display&, |
95 uint32_t) { | 101 uint32_t) { |
96 } | 102 } |
97 | 103 |
98 void DisplayOverscanHandler::HandleStart(const base::ListValue* args) { | 104 void DisplayOverscanHandler::HandleStart(const base::ListValue* args) { |
99 int64 display_id = gfx::Display::kInvalidDisplayID; | 105 int64 display_id = gfx::Display::kInvalidDisplayID; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 LOG(ERROR) << "The orientation must be '" << kOrientationHorizontal | 200 LOG(ERROR) << "The orientation must be '" << kOrientationHorizontal |
195 << "' or '" << kOrientationVertical << "': " | 201 << "' or '" << kOrientationVertical << "': " |
196 << orientation; | 202 << orientation; |
197 return; | 203 return; |
198 } | 204 } |
199 overscan_calibrator_->UpdateInsets(insets); | 205 overscan_calibrator_->UpdateInsets(insets); |
200 } | 206 } |
201 | 207 |
202 } // namespace options | 208 } // namespace options |
203 } // namespace chromeos | 209 } // namespace chromeos |
OLD | NEW |