Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Side by Side Diff: chrome/browser/ui/webui/bug_report_ui.cc

Issue 7324017: Split SystemAccess into TimezoneSettings, StatisticsProvider, and SyslogsProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 26 matching lines...) Expand all
37 #include "ui/base/l10n/l10n_util.h" 37 #include "ui/base/l10n/l10n_util.h"
38 #include "ui/base/resource/resource_bundle.h" 38 #include "ui/base/resource/resource_bundle.h"
39 #include "ui/gfx/rect.h" 39 #include "ui/gfx/rect.h"
40 40
41 #if defined(OS_CHROMEOS) 41 #if defined(OS_CHROMEOS)
42 #include "base/file_util.h" 42 #include "base/file_util.h"
43 #include "base/path_service.h" 43 #include "base/path_service.h"
44 #include "base/synchronization/waitable_event.h" 44 #include "base/synchronization/waitable_event.h"
45 #include "chrome/browser/chromeos/cros/cros_library.h" 45 #include "chrome/browser/chromeos/cros/cros_library.h"
46 #include "chrome/browser/chromeos/login/user_manager.h" 46 #include "chrome/browser/chromeos/login/user_manager.h"
47 #include "chrome/browser/chromeos/system_access.h" 47 #include "chrome/browser/chromeos/system/syslogs_provider.h"
48 #endif 48 #endif
49 49
50 namespace { 50 namespace {
51 51
52 const char kScreenshotBaseUrl[] = "chrome://screenshots/"; 52 const char kScreenshotBaseUrl[] = "chrome://screenshots/";
53 const char kCurrentScreenshotUrl[] = "chrome://screenshots/current"; 53 const char kCurrentScreenshotUrl[] = "chrome://screenshots/current";
54 #if defined(OS_CHROMEOS) 54 #if defined(OS_CHROMEOS)
55 const char kSavedScreenshotsUrl[] = "chrome://screenshots/saved/"; 55 const char kSavedScreenshotsUrl[] = "chrome://screenshots/saved/";
56 56
57 const char kScreenshotPattern[] = "*.png"; 57 const char kScreenshotPattern[] = "*.png";
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 216
217 void CancelFeedbackCollection(); 217 void CancelFeedbackCollection();
218 void CloseFeedbackTab(); 218 void CloseFeedbackTab();
219 219
220 TabContents* tab_; 220 TabContents* tab_;
221 ScreenshotSource* screenshot_source_; 221 ScreenshotSource* screenshot_source_;
222 222
223 BugReportData* bug_report_; 223 BugReportData* bug_report_;
224 std::string target_tab_url_; 224 std::string target_tab_url_;
225 #if defined(OS_CHROMEOS) 225 #if defined(OS_CHROMEOS)
226 // Variables to track SystemAccess::RequestSyslogs callback. 226 // Variables to track SyslogsProvider::RequestSyslogs callback.
227 chromeos::SystemAccess::Handle syslogs_handle_; 227 chromeos::system::SyslogsProvider::Handle syslogs_handle_;
228 CancelableRequestConsumer syslogs_consumer_; 228 CancelableRequestConsumer syslogs_consumer_;
229 #endif 229 #endif
230 230
231 DISALLOW_COPY_AND_ASSIGN(BugReportHandler); 231 DISALLOW_COPY_AND_ASSIGN(BugReportHandler);
232 }; 232 };
233 233
234 //////////////////////////////////////////////////////////////////////////////// 234 ////////////////////////////////////////////////////////////////////////////////
235 // 235 //
236 // BugReportHTMLSource 236 // BugReportHTMLSource
237 // 237 //
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 // 0: current url 559 // 0: current url
560 if (target_tab_url_.length()) 560 if (target_tab_url_.length())
561 dialog_defaults.Append(new StringValue(target_tab_url_)); 561 dialog_defaults.Append(new StringValue(target_tab_url_));
562 else 562 else
563 dialog_defaults.Append(new StringValue("")); 563 dialog_defaults.Append(new StringValue(""));
564 564
565 #if defined(OS_CHROMEOS) 565 #if defined(OS_CHROMEOS)
566 // 1: about:system 566 // 1: about:system
567 dialog_defaults.Append(new StringValue(chrome::kChromeUISystemInfoURL)); 567 dialog_defaults.Append(new StringValue(chrome::kChromeUISystemInfoURL));
568 // Trigger the request for system information here. 568 // Trigger the request for system information here.
569 chromeos::SystemAccess* system_access = 569 chromeos::system::SyslogsProvider* provider =
570 chromeos::SystemAccess::GetInstance(); 570 chromeos::system::SyslogsProvider::GetInstance();
571 if (system_access) { 571 if (provider) {
572 syslogs_handle_ = system_access->RequestSyslogs( 572 syslogs_handle_ = provider->RequestSyslogs(
573 true, // don't compress. 573 true, // don't compress.
574 chromeos::SystemAccess::SYSLOGS_FEEDBACK, 574 chromeos::system::SyslogsProvider::SYSLOGS_FEEDBACK,
575 &syslogs_consumer_, 575 &syslogs_consumer_,
576 NewCallback(bug_report_, &BugReportData::SyslogsComplete)); 576 NewCallback(bug_report_, &BugReportData::SyslogsComplete));
577 } 577 }
578 // 2: user e-mail 578 // 2: user e-mail
579 dialog_defaults.Append(new StringValue(GetUserEmail())); 579 dialog_defaults.Append(new StringValue(GetUserEmail()));
580 #endif 580 #endif
581 581
582 web_ui_->CallJavascriptFunction("setupDialogDefaults", dialog_defaults); 582 web_ui_->CallJavascriptFunction("setupDialogDefaults", dialog_defaults);
583 } 583 }
584 584
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 718
719 void BugReportHandler::HandleOpenSystemTab(const ListValue* args) { 719 void BugReportHandler::HandleOpenSystemTab(const ListValue* args) {
720 #if defined(OS_CHROMEOS) 720 #if defined(OS_CHROMEOS)
721 BrowserList::GetLastActive()->OpenSystemTabAndActivate(); 721 BrowserList::GetLastActive()->OpenSystemTabAndActivate();
722 #endif 722 #endif
723 } 723 }
724 724
725 void BugReportHandler::CancelFeedbackCollection() { 725 void BugReportHandler::CancelFeedbackCollection() {
726 #if defined(OS_CHROMEOS) 726 #if defined(OS_CHROMEOS)
727 if (syslogs_handle_ != 0) { 727 if (syslogs_handle_ != 0) {
728 chromeos::SystemAccess* system_access = 728 chromeos::system::SyslogsProvider* provider =
729 chromeos::SystemAccess::GetInstance(); 729 chromeos::system::SyslogsProvider::GetInstance();
730 if (system_access) 730 if (provider)
731 system_access->CancelRequest(syslogs_handle_); 731 provider->CancelRequest(syslogs_handle_);
732 } 732 }
733 #endif 733 #endif
734 } 734 }
735 735
736 void BugReportHandler::CloseFeedbackTab() { 736 void BugReportHandler::CloseFeedbackTab() {
737 ClobberScreenshotsSource(); 737 ClobberScreenshotsSource();
738 738
739 Browser* browser = BrowserList::GetLastActive(); 739 Browser* browser = BrowserList::GetLastActive();
740 if (browser) { 740 if (browser) {
741 browser->CloseTabContents(tab_); 741 browser->CloseTabContents(tab_);
(...skipping 11 matching lines...) Expand all
753 BugReportHandler* handler = new BugReportHandler(tab); 753 BugReportHandler* handler = new BugReportHandler(tab);
754 AddMessageHandler((handler)->Attach(this)); 754 AddMessageHandler((handler)->Attach(this));
755 755
756 // The handler's init will specify which html 756 // The handler's init will specify which html
757 // resource we'll display to the user 757 // resource we'll display to the user
758 BugReportUIHTMLSource* html_source = 758 BugReportUIHTMLSource* html_source =
759 new BugReportUIHTMLSource(handler->Init()); 759 new BugReportUIHTMLSource(handler->Init());
760 // Set up the chrome://bugreport/ source. 760 // Set up the chrome://bugreport/ source.
761 tab->profile()->GetChromeURLDataManager()->AddDataSource(html_source); 761 tab->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
762 } 762 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698