summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/views/profile_reset_bubble_view.cc57
-rw-r--r--chrome/browser/ui/views/profile_reset_bubble_view.h7
-rw-r--r--chrome/browser/ui/webui/options/reset_profile_settings_handler.cc25
-rw-r--r--chrome/browser/ui/webui/options/reset_profile_settings_handler.h4
4 files changed, 59 insertions, 34 deletions
diff --git a/chrome/browser/ui/views/profile_reset_bubble_view.cc b/chrome/browser/ui/views/profile_reset_bubble_view.cc
index 1189356..4183a68 100644
--- a/chrome/browser/ui/views/profile_reset_bubble_view.cc
+++ b/chrome/browser/ui/views/profile_reset_bubble_view.cc
@@ -4,8 +4,6 @@
#include "chrome/browser/ui/views/profile_reset_bubble_view.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/values.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/profile_resetter/profile_reset_global_error.h"
@@ -196,6 +194,11 @@ void ProfileResetBubbleView::ResetAllChildren() {
void ProfileResetBubbleView::Init() {
set_margins(gfx::Insets(kMarginHeight, 0, 0, 0));
+ // Start requesting the feedback data.
+ feedback_data_ = ResettableSettingsSnapshot::GetReadableFeedback(
+ profile_,
+ base::Bind(&ProfileResetBubbleView::UpdateFeedbackDetails,
+ weak_factory_.GetWeakPtr()));
SetupLayoutManager(true);
}
@@ -348,29 +351,26 @@ void ProfileResetBubbleView::SetupLayoutManager(bool report_checked) {
layout->AddView(controls_.report_settings_checkbox);
layout->AddView(controls_.help_button);
- if (show_help_pane_) {
- scoped_ptr<base::ListValue> feedback(GetReadableFeedback(profile_));
- if (feedback.get()) {
- // We need a single row to add the scroll view containing the feedback.
- const int kReportDetailsColumnSetId = 5;
- cs = layout->AddColumnSet(kReportDetailsColumnSetId);
- cs->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
- GridLayout::USE_PREF, 0, 0);
-
- FeedbackView* feedback_view = new FeedbackView();
- feedback_view->SetupLayoutManager(*feedback.get());
-
- views::ScrollView* scroll_view = new views::ScrollView();
- scroll_view->set_background(views::Background::CreateSolidBackground(
- kLightGrayBackgroundColor));
- scroll_view->SetContents(feedback_view);
-
- layout->StartRow(1, kReportDetailsColumnSetId);
- layout->AddView(scroll_view, 1, 1, GridLayout::FILL,
- GridLayout::FILL, kAllColumnsWidth,
- std::min(feedback_view->height() + kMarginHeight,
- kMaxFeedbackViewHeight));
- }
+ if (show_help_pane_ && feedback_data_) {
+ // We need a single row to add the scroll view containing the feedback.
+ const int kReportDetailsColumnSetId = 5;
+ cs = layout->AddColumnSet(kReportDetailsColumnSetId);
+ cs->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
+ GridLayout::USE_PREF, 0, 0);
+
+ FeedbackView* feedback_view = new FeedbackView();
+ feedback_view->SetupLayoutManager(*feedback_data_);
+
+ views::ScrollView* scroll_view = new views::ScrollView();
+ scroll_view->set_background(views::Background::CreateSolidBackground(
+ kLightGrayBackgroundColor));
+ scroll_view->SetContents(feedback_view);
+
+ layout->StartRow(1, kReportDetailsColumnSetId);
+ layout->AddView(scroll_view, 1, 1, GridLayout::FILL,
+ GridLayout::FILL, kAllColumnsWidth,
+ std::min(feedback_view->height() + kMarginHeight,
+ kMaxFeedbackViewHeight));
}
Layout();
@@ -427,6 +427,13 @@ void ProfileResetBubbleView::CloseBubbleView() {
StartFade(false);
}
+void ProfileResetBubbleView::UpdateFeedbackDetails(
+ scoped_ptr<base::ListValue> feedback_list) {
+ feedback_data_ = feedback_list.Pass();
+ if (show_help_pane_)
+ SetupLayoutManager(controls_.report_settings_checkbox->checked());
+}
+
bool IsProfileResetBubbleSupported() {
return true;
}
diff --git a/chrome/browser/ui/views/profile_reset_bubble_view.h b/chrome/browser/ui/views/profile_reset_bubble_view.h
index 8924112..3657e44 100644
--- a/chrome/browser/ui/views/profile_reset_bubble_view.h
+++ b/chrome/browser/ui/views/profile_reset_bubble_view.h
@@ -8,6 +8,7 @@
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/values.h"
#include "chrome/browser/ui/global_error/global_error_bubble_view_base.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/views/bubble/bubble_delegate.h"
@@ -74,6 +75,9 @@ class ProfileResetBubbleView : public views::BubbleDelegateView,
// views::LinkListener method.
virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
+ // Sets the fully populated feedback data.
+ void UpdateFeedbackDetails(scoped_ptr<base::ListValue> feedback_list);
+
struct Controls {
Controls() {
Reset();
@@ -98,6 +102,9 @@ class ProfileResetBubbleView : public views::BubbleDelegateView,
views::Checkbox* report_settings_checkbox;
} controls_;
+ // Feedback shown to user.
+ scoped_ptr<base::ListValue> feedback_data_;
+
// A version of the help image that is brighter.
gfx::ImageSkia brighter_help_image_;
diff --git a/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc b/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
index 975891b..a245bb8 100644
--- a/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
@@ -114,7 +114,7 @@ void ResetProfileSettingsHandler::OnResetProfileSettingsDone() {
web_ui()->CallJavascriptFunction("ResetProfileSettingsOverlay.doneResetting");
if (setting_snapshot_) {
Profile* profile = Profile::FromWebUI(web_ui());
- ResettableSettingsSnapshot current_snapshot(profile);
+ ResettableSettingsSnapshot current_snapshot(profile, false);
int difference = setting_snapshot_->FindDifferentFields(current_snapshot);
if (difference) {
setting_snapshot_->Subtract(current_snapshot);
@@ -134,13 +134,10 @@ void ResetProfileSettingsHandler::OnResetProfileSettingsDone() {
}
void ResetProfileSettingsHandler::OnShowResetProfileDialog(
- const base::ListValue*) {
- base::DictionaryValue flashInfo;
- flashInfo.Set("feedbackInfo", GetReadableFeedback(
- Profile::FromWebUI(web_ui())));
- web_ui()->CallJavascriptFunction(
- "ResetProfileSettingsOverlay.setFeedbackInfo",
- flashInfo);
+ const base::ListValue* value) {
+ UpdateFeedbackUI(ResettableSettingsSnapshot::GetReadableFeedback(
+ Profile::FromWebUI(web_ui()),
+ base::Bind(&ResetProfileSettingsHandler::UpdateFeedbackUI, AsWeakPtr())));
if (automatic_profile_resetter_)
automatic_profile_resetter_->NotifyDidOpenWebUIResetDialog();
@@ -186,7 +183,8 @@ void ResetProfileSettingsHandler::ResetProfile(bool send_settings) {
default_settings.reset(new BrandcodedDefaultSettings);
// Save current settings if required.
setting_snapshot_.reset(send_settings ?
- new ResettableSettingsSnapshot(Profile::FromWebUI(web_ui())) : NULL);
+ new ResettableSettingsSnapshot(Profile::FromWebUI(web_ui()), true) :
+ NULL);
resetter_->Reset(
ProfileResetter::ALL,
default_settings.Pass(),
@@ -196,4 +194,13 @@ void ResetProfileSettingsHandler::ResetProfile(bool send_settings) {
UMA_HISTOGRAM_BOOLEAN("ProfileReset.SendFeedback", send_settings);
}
+void ResetProfileSettingsHandler::UpdateFeedbackUI(
+ scoped_ptr<base::ListValue> list) {
+ base::DictionaryValue feedback_info;
+ feedback_info.Set("feedbackInfo", list.release());
+ web_ui()->CallJavascriptFunction(
+ "ResetProfileSettingsOverlay.setFeedbackInfo",
+ feedback_info);
+}
+
} // namespace options
diff --git a/chrome/browser/ui/webui/options/reset_profile_settings_handler.h b/chrome/browser/ui/webui/options/reset_profile_settings_handler.h
index ab8766f..8914290 100644
--- a/chrome/browser/ui/webui/options/reset_profile_settings_handler.h
+++ b/chrome/browser/ui/webui/options/reset_profile_settings_handler.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/webui/options/options_ui.h"
@@ -60,6 +61,9 @@ class ResetProfileSettingsHandler
// gave his consent to upload broken settings to Google for analysis.
void ResetProfile(bool send_settings);
+ // Sets new values for the feedback area.
+ void UpdateFeedbackUI(scoped_ptr<base::ListValue> list);
+
// Destroyed with the Profile, thus it should outlive us. This will be NULL if
// the underlying profile is off-the-record (e.g. in Guest mode on Chrome OS).
AutomaticProfileResetter* automatic_profile_resetter_;