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

Side by Side Diff: chrome/browser/feedback/feedback_util.cc

Issue 191093002: Simplify the user agent code some more since after r255534 it's not affected by the site's URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: patchset 15 which works Created 6 years, 9 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) 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/feedback/feedback_util.h" 5 #include "chrome/browser/feedback/feedback_util.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/feedback/feedback_uploader.h" 24 #include "chrome/browser/feedback/feedback_uploader.h"
25 #include "chrome/browser/feedback/feedback_uploader_factory.h" 25 #include "chrome/browser/feedback/feedback_uploader_factory.h"
26 #include "chrome/browser/metrics/variations/variations_http_header_provider.h" 26 #include "chrome/browser/metrics/variations/variations_http_header_provider.h"
27 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/profiles/profile_manager.h" 28 #include "chrome/browser/profiles/profile_manager.h"
29 #include "chrome/browser/safe_browsing/safe_browsing_util.h" 29 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
30 #include "chrome/browser/ui/browser_finder.h" 30 #include "chrome/browser/ui/browser_finder.h"
31 #include "chrome/browser/ui/browser_list.h" 31 #include "chrome/browser/ui/browser_list.h"
32 #include "chrome/browser/ui/browser_window.h" 32 #include "chrome/browser/ui/browser_window.h"
33 #include "chrome/browser/ui/tabs/tab_strip_model.h" 33 #include "chrome/browser/ui/tabs/tab_strip_model.h"
34 #include "chrome/common/chrome_content_client.h"
34 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/chrome_version_info.h" 36 #include "chrome/common/chrome_version_info.h"
36 #include "chrome/common/metrics/metrics_log_manager.h" 37 #include "chrome/common/metrics/metrics_log_manager.h"
37 #include "content/public/browser/navigation_controller.h" 38 #include "content/public/browser/navigation_controller.h"
38 #include "content/public/browser/web_contents.h" 39 #include "content/public/browser/web_contents.h"
39 #include "content/public/common/content_client.h" 40 #include "content/public/common/content_client.h"
40 #include "grit/generated_resources.h" 41 #include "grit/generated_resources.h"
41 #include "grit/locale_settings.h" 42 #include "grit/locale_settings.h"
42 #include "grit/theme_resources.h" 43 #include "grit/theme_resources.h"
43 #include "net/base/load_flags.h" 44 #include "net/base/load_flags.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // We're not using gaia ids, we're using the e-mail field instead. 159 // We're not using gaia ids, we're using the e-mail field instead.
159 common_data->set_gaia_id(0); 160 common_data->set_gaia_id(0);
160 common_data->set_user_email(data->user_email()); 161 common_data->set_user_email(data->user_email());
161 common_data->set_description(data->description()); 162 common_data->set_description(data->description());
162 163
163 std::string chrome_locale = g_browser_process->GetApplicationLocale(); 164 std::string chrome_locale = g_browser_process->GetApplicationLocale();
164 common_data->set_source_description_language(chrome_locale); 165 common_data->set_source_description_language(chrome_locale);
165 166
166 userfeedback::WebData* web_data = feedback_data.mutable_web_data(); 167 userfeedback::WebData* web_data = feedback_data.mutable_web_data();
167 web_data->set_url(data->page_url()); 168 web_data->set_url(data->page_url());
168 web_data->mutable_navigator()->set_user_agent(content::GetUserAgent(GURL())); 169 web_data->mutable_navigator()->set_user_agent(GetUserAgent());
169 170
170 gfx::Rect screen_size; 171 gfx::Rect screen_size;
171 if (data->sys_info()) { 172 if (data->sys_info()) {
172 for (FeedbackData::SystemLogsMap::const_iterator i = 173 for (FeedbackData::SystemLogsMap::const_iterator i =
173 data->sys_info()->begin(); i != data->sys_info()->end(); ++i) { 174 data->sys_info()->begin(); i != data->sys_info()->end(); ++i) {
174 if (FeedbackData::BelowCompressionThreshold(i->second)) 175 if (FeedbackData::BelowCompressionThreshold(i->second))
175 AddFeedbackData(&feedback_data, i->first, i->second); 176 AddFeedbackData(&feedback_data, i->first, i->second);
176 } 177 }
177 178
178 AddAttachment(&feedback_data, kLogsAttachmentName, data->compressed_logs()); 179 AddAttachment(&feedback_data, kLogsAttachmentName, data->compressed_logs());
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 zip::Zip(temp_path, zip_file, false) && 263 zip::Zip(temp_path, zip_file, false) &&
263 base::ReadFileToString(zip_file, compressed_logs); 264 base::ReadFileToString(zip_file, compressed_logs);
264 265
265 base::DeleteFile(temp_path, true); 266 base::DeleteFile(temp_path, true);
266 base::DeleteFile(zip_file, false); 267 base::DeleteFile(zip_file, false);
267 268
268 return succeed; 269 return succeed;
269 } 270 }
270 271
271 } // namespace feedback_util 272 } // namespace feedback_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698