OLD | NEW |
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/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "chrome/browser/net/url_fixer_upper.h" | 13 #include "chrome/browser/net/url_fixer_upper.h" |
14 #include "chrome/browser/ui/browser_dialogs.h" | 14 #include "chrome/browser/ui/browser_dialogs.h" |
15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
17 #include "content/public/browser/sensors_provider.h" | |
18 | 17 |
19 #if defined(USE_TCMALLOC) | 18 #if defined(USE_TCMALLOC) |
20 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" | 19 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" |
21 #endif | 20 #endif |
22 | 21 |
23 namespace { | 22 namespace { |
24 | 23 |
25 // Add paths here to be included in chrome://chrome-urls (about:about). | 24 // Add paths here to be included in chrome://chrome-urls (about:about). |
26 // These paths will also be suggested by BuiltinProvider. | 25 // These paths will also be suggested by BuiltinProvider. |
27 const char* const kChromePaths[] = { | 26 const char* const kChromePaths[] = { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 #if (defined(OS_MACOSX) || defined(OS_WIN)) && defined(IPC_MESSAGE_LOG_ENABLED) | 153 #if (defined(OS_MACOSX) || defined(OS_WIN)) && defined(IPC_MESSAGE_LOG_ENABLED) |
155 if (LowerCaseEqualsASCII(url.spec(), chrome::kChromeUIIPCURL)) { | 154 if (LowerCaseEqualsASCII(url.spec(), chrome::kChromeUIIPCURL)) { |
156 // Run the dialog. This will re-use the existing one if it's already up. | 155 // Run the dialog. This will re-use the existing one if it's already up. |
157 browser::ShowAboutIPCDialog(); | 156 browser::ShowAboutIPCDialog(); |
158 return true; | 157 return true; |
159 } | 158 } |
160 #endif | 159 #endif |
161 | 160 |
162 #endif // OFFICIAL_BUILD | 161 #endif // OFFICIAL_BUILD |
163 | 162 |
164 #if defined(OS_CHROMEOS) | |
165 if (host == chrome::kChromeUIRotateHost) { | |
166 content::ScreenOrientation change = content::SCREEN_ORIENTATION_TOP; | |
167 std::string query(url.query()); | |
168 if (query == "left") { | |
169 change = content::SCREEN_ORIENTATION_LEFT; | |
170 } else if (query == "right") { | |
171 change = content::SCREEN_ORIENTATION_RIGHT; | |
172 } else if (query == "top") { | |
173 change = content::SCREEN_ORIENTATION_TOP; | |
174 } else if (query == "bottom") { | |
175 change = content::SCREEN_ORIENTATION_BOTTOM; | |
176 } else { | |
177 NOTREACHED() << "Unknown orientation"; | |
178 } | |
179 content::SensorsProvider::GetInstance()->ScreenOrientationChanged(change); | |
180 return true; | |
181 } | |
182 #endif | |
183 | |
184 return false; | 163 return false; |
185 } | 164 } |
186 | 165 |
187 std::vector<std::string> ChromePaths() { | 166 std::vector<std::string> ChromePaths() { |
188 std::vector<std::string> paths; | 167 std::vector<std::string> paths; |
189 paths.reserve(arraysize(kChromePaths)); | 168 paths.reserve(arraysize(kChromePaths)); |
190 for (size_t i = 0; i < arraysize(kChromePaths); i++) | 169 for (size_t i = 0; i < arraysize(kChromePaths); i++) |
191 paths.push_back(kChromePaths[i]); | 170 paths.push_back(kChromePaths[i]); |
192 return paths; | 171 return paths; |
193 } | 172 } |
194 | 173 |
195 #if defined(USE_TCMALLOC) | 174 #if defined(USE_TCMALLOC) |
196 // static | 175 // static |
197 AboutTcmallocOutputs* AboutTcmallocOutputs::GetInstance() { | 176 AboutTcmallocOutputs* AboutTcmallocOutputs::GetInstance() { |
198 return Singleton<AboutTcmallocOutputs>::get(); | 177 return Singleton<AboutTcmallocOutputs>::get(); |
199 } | 178 } |
200 | 179 |
201 AboutTcmallocOutputs::AboutTcmallocOutputs() {} | 180 AboutTcmallocOutputs::AboutTcmallocOutputs() {} |
202 | 181 |
203 AboutTcmallocOutputs::~AboutTcmallocOutputs() {} | 182 AboutTcmallocOutputs::~AboutTcmallocOutputs() {} |
204 | 183 |
205 // Glue between the callback task and the method in the singleton. | 184 // Glue between the callback task and the method in the singleton. |
206 void AboutTcmallocRendererCallback(base::ProcessId pid, | 185 void AboutTcmallocRendererCallback(base::ProcessId pid, |
207 const std::string& output) { | 186 const std::string& output) { |
208 AboutTcmallocOutputs::GetInstance()->RendererCallback(pid, output); | 187 AboutTcmallocOutputs::GetInstance()->RendererCallback(pid, output); |
209 } | 188 } |
210 #endif | 189 #endif |
OLD | NEW |