OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <iostream> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/callback.h" | 12 #include "base/callback.h" |
12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
13 #include "base/file_util.h" | 14 #include "base/file_util.h" |
14 #include "base/i18n/number_formatting.h" | 15 #include "base/i18n/number_formatting.h" |
15 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
16 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
(...skipping 22 matching lines...) Expand all Loading... |
40 #include "chrome/common/chrome_paths.h" | 41 #include "chrome/common/chrome_paths.h" |
41 #include "chrome/common/chrome_version_info.h" | 42 #include "chrome/common/chrome_version_info.h" |
42 #include "chrome/common/jstemplate_builder.h" | 43 #include "chrome/common/jstemplate_builder.h" |
43 #include "chrome/common/net/gaia/google_service_auth_error.h" | 44 #include "chrome/common/net/gaia/google_service_auth_error.h" |
44 #include "chrome/common/render_messages.h" | 45 #include "chrome/common/render_messages.h" |
45 #include "chrome/common/url_constants.h" | 46 #include "chrome/common/url_constants.h" |
46 #include "content/browser/browser_thread.h" | 47 #include "content/browser/browser_thread.h" |
47 #include "content/browser/gpu/gpu_process_host.h" | 48 #include "content/browser/gpu/gpu_process_host.h" |
48 #include "content/browser/renderer_host/render_process_host.h" | 49 #include "content/browser/renderer_host/render_process_host.h" |
49 #include "content/browser/renderer_host/render_view_host.h" | 50 #include "content/browser/renderer_host/render_view_host.h" |
| 51 #include "content/browser/sensors/provider.h" |
50 #include "content/common/gpu/gpu_messages.h" | 52 #include "content/common/gpu/gpu_messages.h" |
51 #include "crypto/nss_util.h" | 53 #include "crypto/nss_util.h" |
52 #include "googleurl/src/gurl.h" | 54 #include "googleurl/src/gurl.h" |
53 #include "grit/browser_resources.h" | 55 #include "grit/browser_resources.h" |
54 #include "grit/chromium_strings.h" | 56 #include "grit/chromium_strings.h" |
55 #include "grit/generated_resources.h" | 57 #include "grit/generated_resources.h" |
56 #include "grit/locale_settings.h" | 58 #include "grit/locale_settings.h" |
57 #include "net/base/escape.h" | 59 #include "net/base/escape.h" |
58 #include "ui/base/l10n/l10n_util.h" | 60 #include "ui/base/l10n/l10n_util.h" |
59 #include "ui/base/resource/resource_bundle.h" | 61 #include "ui/base/resource/resource_bundle.h" |
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 CHECK(false); | 1444 CHECK(false); |
1443 } else if (host == chrome::kChromeUIGpuCleanHost) { | 1445 } else if (host == chrome::kChromeUIGpuCleanHost) { |
1444 GpuProcessHost::SendOnIO( | 1446 GpuProcessHost::SendOnIO( |
1445 0, content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, new GpuMsg_Clean()); | 1447 0, content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, new GpuMsg_Clean()); |
1446 } else if (host == chrome::kChromeUIGpuCrashHost) { | 1448 } else if (host == chrome::kChromeUIGpuCrashHost) { |
1447 GpuProcessHost::SendOnIO( | 1449 GpuProcessHost::SendOnIO( |
1448 0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUCRASH, new GpuMsg_Crash()); | 1450 0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUCRASH, new GpuMsg_Crash()); |
1449 } else if (host == chrome::kChromeUIGpuHangHost) { | 1451 } else if (host == chrome::kChromeUIGpuHangHost) { |
1450 GpuProcessHost::SendOnIO( | 1452 GpuProcessHost::SendOnIO( |
1451 0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUHANG, new GpuMsg_Hang()); | 1453 0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUHANG, new GpuMsg_Hang()); |
| 1454 } else if (host == chrome::kChromeUIRotateHost) { |
| 1455 sensors::ScreenOrientationChange change; |
| 1456 std::string query(url->query()); |
| 1457 if (query == "left") { |
| 1458 change.upward = sensors::ScreenOrientationChange::LEFT; |
| 1459 } else if (query == "right") { |
| 1460 change.upward = sensors::ScreenOrientationChange::RIGHT; |
| 1461 } else if (query == "top") { |
| 1462 change.upward = sensors::ScreenOrientationChange::TOP; |
| 1463 } else if (query == "bottom") { |
| 1464 change.upward = sensors::ScreenOrientationChange::BOTTOM; |
| 1465 } |
| 1466 std::string data(reinterpret_cast<const char*>(&change), sizeof(change)); |
| 1467 sensors::Provider::GetInstance()->FireSensorChanged( |
| 1468 sensors::kScreenOrientationChannel, data); |
| 1469 |
| 1470 host = chrome::kChromeUIBlankHost; |
| 1471 *url = GURL(chrome::kChromeUIBlankHost); |
1452 } | 1472 } |
1453 | 1473 |
1454 // Initialize any potentially corresponding AboutSource handler. | 1474 // Initialize any potentially corresponding AboutSource handler. |
1455 InitializeAboutDataSource(host, profile); | 1475 InitializeAboutDataSource(host, profile); |
1456 return true; | 1476 return true; |
1457 } | 1477 } |
1458 | 1478 |
1459 bool HandleNonNavigationAboutURL(const GURL& url) { | 1479 bool HandleNonNavigationAboutURL(const GURL& url) { |
1460 // chrome://ipc/ is currently buggy, so we disable it for official builds. | 1480 // chrome://ipc/ is currently buggy, so we disable it for official builds. |
1461 #if !defined(OFFICIAL_BUILD) | 1481 #if !defined(OFFICIAL_BUILD) |
(...skipping 11 matching lines...) Expand all Loading... |
1473 return false; | 1493 return false; |
1474 } | 1494 } |
1475 | 1495 |
1476 std::vector<std::string> ChromePaths() { | 1496 std::vector<std::string> ChromePaths() { |
1477 std::vector<std::string> paths; | 1497 std::vector<std::string> paths; |
1478 paths.reserve(arraysize(kChromePaths)); | 1498 paths.reserve(arraysize(kChromePaths)); |
1479 for (size_t i = 0; i < arraysize(kChromePaths); i++) | 1499 for (size_t i = 0; i < arraysize(kChromePaths); i++) |
1480 paths.push_back(kChromePaths[i]); | 1500 paths.push_back(kChromePaths[i]); |
1481 return paths; | 1501 return paths; |
1482 } | 1502 } |
OLD | NEW |