| 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/ui/webui/crashes_ui.h" | 5 #include "chrome/browser/ui/webui/crashes_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" |
| 11 #include "base/i18n/time_formatting.h" | 11 #include "base/i18n/time_formatting.h" |
| 12 #include "base/memory/ref_counted_memory.h" | 12 #include "base/memory/ref_counted_memory.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/crash_upload_list.h" | 15 #include "chrome/browser/crash_upload_list.h" |
| 16 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 16 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/common/chrome_version_info.h" | 18 #include "chrome/common/chrome_version_info.h" |
| 19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 20 #include "chrome/grit/chromium_strings.h" |
| 21 #include "chrome/grit/generated_resources.h" |
| 20 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 21 #include "content/public/browser/web_ui.h" | 23 #include "content/public/browser/web_ui.h" |
| 22 #include "content/public/browser/web_ui_data_source.h" | 24 #include "content/public/browser/web_ui_data_source.h" |
| 23 #include "content/public/browser/web_ui_message_handler.h" | 25 #include "content/public/browser/web_ui_message_handler.h" |
| 24 #include "grit/browser_resources.h" | 26 #include "grit/browser_resources.h" |
| 25 #include "grit/chromium_strings.h" | |
| 26 #include "grit/generated_resources.h" | |
| 27 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 29 | 29 |
| 30 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
| 31 #include "chromeos/dbus/dbus_thread_manager.h" | 31 #include "chromeos/dbus/dbus_thread_manager.h" |
| 32 #include "chromeos/dbus/debug_daemon_client.h" | 32 #include "chromeos/dbus/debug_daemon_client.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 using content::WebContents; | 35 using content::WebContents; |
| 36 using content::WebUIMessageHandler; | 36 using content::WebUIMessageHandler; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 65 //////////////////////////////////////////////////////////////////////////////// | 65 //////////////////////////////////////////////////////////////////////////////// |
| 66 // | 66 // |
| 67 // CrashesDOMHandler | 67 // CrashesDOMHandler |
| 68 // | 68 // |
| 69 //////////////////////////////////////////////////////////////////////////////// | 69 //////////////////////////////////////////////////////////////////////////////// |
| 70 | 70 |
| 71 // The handler for Javascript messages for the chrome://crashes/ page. | 71 // The handler for Javascript messages for the chrome://crashes/ page. |
| 72 class CrashesDOMHandler : public WebUIMessageHandler, | 72 class CrashesDOMHandler : public WebUIMessageHandler, |
| 73 public CrashUploadList::Delegate { | 73 public CrashUploadList::Delegate { |
| 74 public: | 74 public: |
| 75 explicit CrashesDOMHandler(); | 75 CrashesDOMHandler(); |
| 76 virtual ~CrashesDOMHandler(); | 76 virtual ~CrashesDOMHandler(); |
| 77 | 77 |
| 78 // WebUIMessageHandler implementation. | 78 // WebUIMessageHandler implementation. |
| 79 virtual void RegisterMessages() OVERRIDE; | 79 virtual void RegisterMessages() OVERRIDE; |
| 80 | 80 |
| 81 // CrashUploadList::Delegate implemenation. | 81 // CrashUploadList::Delegate implemenation. |
| 82 virtual void OnUploadListAvailable() OVERRIDE; | 82 virtual void OnUploadListAvailable() OVERRIDE; |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 // Asynchronously fetches the list of crashes. Called from JS. | 85 // Asynchronously fetches the list of crashes. Called from JS. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 Profile* profile = Profile::FromWebUI(web_ui); | 199 Profile* profile = Profile::FromWebUI(web_ui); |
| 200 content::WebUIDataSource::Add(profile, CreateCrashesUIHTMLSource()); | 200 content::WebUIDataSource::Add(profile, CreateCrashesUIHTMLSource()); |
| 201 } | 201 } |
| 202 | 202 |
| 203 // static | 203 // static |
| 204 base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes( | 204 base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes( |
| 205 ui::ScaleFactor scale_factor) { | 205 ui::ScaleFactor scale_factor) { |
| 206 return ResourceBundle::GetSharedInstance(). | 206 return ResourceBundle::GetSharedInstance(). |
| 207 LoadDataResourceBytesForScale(IDR_SAD_FAVICON, scale_factor); | 207 LoadDataResourceBytesForScale(IDR_SAD_FAVICON, scale_factor); |
| 208 } | 208 } |
| OLD | NEW |