| 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/ui/webui/bug_report_ui.h" | 5 #include "chrome/browser/ui/webui/bug_report_ui.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 24 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 24 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 25 #include "chrome/browser/ui/webui/screenshot_source.h" | 25 #include "chrome/browser/ui/webui/screenshot_source.h" |
| 26 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" | 26 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" |
| 27 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
| 28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 29 #include "content/browser/tab_contents/navigation_controller.h" | 29 #include "content/browser/tab_contents/navigation_controller.h" |
| 30 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 31 #include "content/public/browser/navigation_entry.h" | 31 #include "content/public/browser/navigation_entry.h" |
| 32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
| 33 #include "content/public/browser/web_ui_message_handler.h" |
| 33 #include "grit/browser_resources.h" | 34 #include "grit/browser_resources.h" |
| 34 #include "grit/chromium_strings.h" | 35 #include "grit/chromium_strings.h" |
| 35 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
| 36 #include "grit/locale_settings.h" | 37 #include "grit/locale_settings.h" |
| 37 #include "net/base/escape.h" | 38 #include "net/base/escape.h" |
| 38 #include "ui/base/resource/resource_bundle.h" | 39 #include "ui/base/resource/resource_bundle.h" |
| 39 | 40 |
| 40 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
| 41 #include "base/file_util.h" | 42 #include "base/file_util.h" |
| 42 #include "base/path_service.h" | 43 #include "base/path_service.h" |
| 43 #include "base/synchronization/waitable_event.h" | 44 #include "base/synchronization/waitable_event.h" |
| 44 #include "chrome/browser/chromeos/cros/cros_library.h" | 45 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 45 #include "chrome/browser/chromeos/login/user_manager.h" | 46 #include "chrome/browser/chromeos/login/user_manager.h" |
| 46 #include "chrome/browser/chromeos/system/syslogs_provider.h" | 47 #include "chrome/browser/chromeos/system/syslogs_provider.h" |
| 47 #endif | 48 #endif |
| 48 | 49 |
| 49 using content::BrowserThread; | 50 using content::BrowserThread; |
| 50 using content::WebContents; | 51 using content::WebContents; |
| 52 using content::WebUIMessageHandler; |
| 51 | 53 |
| 52 namespace { | 54 namespace { |
| 53 | 55 |
| 54 const char kScreenshotBaseUrl[] = "chrome://screenshots/"; | 56 const char kScreenshotBaseUrl[] = "chrome://screenshots/"; |
| 55 const char kCurrentScreenshotUrl[] = "chrome://screenshots/current"; | 57 const char kCurrentScreenshotUrl[] = "chrome://screenshots/current"; |
| 56 #if defined(OS_CHROMEOS) | 58 #if defined(OS_CHROMEOS) |
| 57 const char kSavedScreenshotsUrl[] = "chrome://screenshots/saved/"; | 59 const char kSavedScreenshotsUrl[] = "chrome://screenshots/saved/"; |
| 58 const char kScreenshotPattern[] = "screenshot-*.png"; | 60 const char kScreenshotPattern[] = "screenshot-*.png"; |
| 59 | 61 |
| 60 const size_t kMaxSavedScreenshots = 2; | 62 const size_t kMaxSavedScreenshots = 2; |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 AddMessageHandler(handler); | 623 AddMessageHandler(handler); |
| 622 | 624 |
| 623 // The handler's init will determine whether we show the error html page. | 625 // The handler's init will determine whether we show the error html page. |
| 624 ChromeWebUIDataSource* html_source = | 626 ChromeWebUIDataSource* html_source = |
| 625 CreateBugReportUIHTMLSource(handler->Init()); | 627 CreateBugReportUIHTMLSource(handler->Init()); |
| 626 | 628 |
| 627 // Set up the chrome://bugreport/ source. | 629 // Set up the chrome://bugreport/ source. |
| 628 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); | 630 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
| 629 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 631 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
| 630 } | 632 } |
| OLD | NEW |