| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "chrome/common/chrome_paths.h" | 41 #include "chrome/common/chrome_paths.h" |
| 42 #include "chrome/common/chrome_version_info.h" | 42 #include "chrome/common/chrome_version_info.h" |
| 43 #include "chrome/common/jstemplate_builder.h" | 43 #include "chrome/common/jstemplate_builder.h" |
| 44 #include "chrome/common/net/gaia/google_service_auth_error.h" | 44 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 45 #include "chrome/common/render_messages.h" | 45 #include "chrome/common/render_messages.h" |
| 46 #include "chrome/common/url_constants.h" | 46 #include "chrome/common/url_constants.h" |
| 47 #include "content/browser/browser_thread.h" | 47 #include "content/browser/browser_thread.h" |
| 48 #include "content/browser/gpu/gpu_process_host.h" | 48 #include "content/browser/gpu/gpu_process_host.h" |
| 49 #include "content/browser/renderer_host/render_process_host.h" | 49 #include "content/browser/renderer_host/render_process_host.h" |
| 50 #include "content/browser/renderer_host/render_view_host.h" | 50 #include "content/browser/renderer_host/render_view_host.h" |
| 51 #include "content/browser/sensors/sensors_provider.h" |
| 51 #include "content/common/gpu/gpu_messages.h" | 52 #include "content/common/gpu/gpu_messages.h" |
| 52 #include "crypto/nss_util.h" | 53 #include "crypto/nss_util.h" |
| 53 #include "googleurl/src/gurl.h" | 54 #include "googleurl/src/gurl.h" |
| 54 #include "grit/browser_resources.h" | 55 #include "grit/browser_resources.h" |
| 55 #include "grit/chromium_strings.h" | 56 #include "grit/chromium_strings.h" |
| 56 #include "grit/generated_resources.h" | 57 #include "grit/generated_resources.h" |
| 57 #include "grit/locale_settings.h" | 58 #include "grit/locale_settings.h" |
| 58 #include "net/base/escape.h" | 59 #include "net/base/escape.h" |
| 59 #include "net/base/net_util.h" | 60 #include "net/base/net_util.h" |
| 60 #include "ui/base/l10n/l10n_util.h" | 61 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 CHECK(false); | 1485 CHECK(false); |
| 1485 } else if (host == chrome::kChromeUIGpuCleanHost) { | 1486 } else if (host == chrome::kChromeUIGpuCleanHost) { |
| 1486 GpuProcessHost::SendOnIO( | 1487 GpuProcessHost::SendOnIO( |
| 1487 0, content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, new GpuMsg_Clean()); | 1488 0, content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, new GpuMsg_Clean()); |
| 1488 } else if (host == chrome::kChromeUIGpuCrashHost) { | 1489 } else if (host == chrome::kChromeUIGpuCrashHost) { |
| 1489 GpuProcessHost::SendOnIO( | 1490 GpuProcessHost::SendOnIO( |
| 1490 0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUCRASH, new GpuMsg_Crash()); | 1491 0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUCRASH, new GpuMsg_Crash()); |
| 1491 } else if (host == chrome::kChromeUIGpuHangHost) { | 1492 } else if (host == chrome::kChromeUIGpuHangHost) { |
| 1492 GpuProcessHost::SendOnIO( | 1493 GpuProcessHost::SendOnIO( |
| 1493 0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUHANG, new GpuMsg_Hang()); | 1494 0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUHANG, new GpuMsg_Hang()); |
| 1495 #if defined(OS_CHROMEOS) |
| 1496 } else if (host == chrome::kChromeUIRotateHost) { |
| 1497 sensors::ScreenOrientation change; |
| 1498 std::string query(url->query()); |
| 1499 if (query == "left") { |
| 1500 change.upward = sensors::ScreenOrientation::LEFT; |
| 1501 } else if (query == "right") { |
| 1502 change.upward = sensors::ScreenOrientation::RIGHT; |
| 1503 } else if (query == "top") { |
| 1504 change.upward = sensors::ScreenOrientation::TOP; |
| 1505 } else if (query == "bottom") { |
| 1506 change.upward = sensors::ScreenOrientation::BOTTOM; |
| 1507 } else { |
| 1508 NOTREACHED() << "Unknown orientation"; |
| 1509 } |
| 1510 sensors::Provider::GetInstance()->ScreenOrientationChanged(change); |
| 1511 // Nothing to communicate to the user, so show a blank page. |
| 1512 host = chrome::kChromeUIBlankHost; |
| 1513 *url = GURL(chrome::kChromeUIBlankHost); |
| 1514 #endif |
| 1494 } | 1515 } |
| 1495 | 1516 |
| 1496 // Initialize any potentially corresponding AboutSource handler. | 1517 // Initialize any potentially corresponding AboutSource handler. |
| 1497 InitializeAboutDataSource(host, browser_context); | 1518 InitializeAboutDataSource(host, browser_context); |
| 1498 return true; | 1519 return true; |
| 1499 } | 1520 } |
| 1500 | 1521 |
| 1501 bool HandleNonNavigationAboutURL(const GURL& url) { | 1522 bool HandleNonNavigationAboutURL(const GURL& url) { |
| 1502 // chrome://ipc/ is currently buggy, so we disable it for official builds. | 1523 // chrome://ipc/ is currently buggy, so we disable it for official builds. |
| 1503 #if !defined(OFFICIAL_BUILD) | 1524 #if !defined(OFFICIAL_BUILD) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1515 return false; | 1536 return false; |
| 1516 } | 1537 } |
| 1517 | 1538 |
| 1518 std::vector<std::string> ChromePaths() { | 1539 std::vector<std::string> ChromePaths() { |
| 1519 std::vector<std::string> paths; | 1540 std::vector<std::string> paths; |
| 1520 paths.reserve(arraysize(kChromePaths)); | 1541 paths.reserve(arraysize(kChromePaths)); |
| 1521 for (size_t i = 0; i < arraysize(kChromePaths); i++) | 1542 for (size_t i = 0; i < arraysize(kChromePaths); i++) |
| 1522 paths.push_back(kChromePaths[i]); | 1543 paths.push_back(kChromePaths[i]); |
| 1523 return paths; | 1544 return paths; |
| 1524 } | 1545 } |
| OLD | NEW |