OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/net_export_ui.h" | 5 #include "chrome/browser/ui/webui/net_export_ui.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "components/net_log/net_export_ui_constants.h" | 26 #include "components/net_log/net_export_ui_constants.h" |
27 #include "components/net_log/net_log_file_writer.h" | 27 #include "components/net_log/net_log_file_writer.h" |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/url_data_source.h" | 29 #include "content/public/browser/url_data_source.h" |
30 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
31 #include "content/public/browser/web_ui.h" | 31 #include "content/public/browser/web_ui.h" |
32 #include "content/public/browser/web_ui_data_source.h" | 32 #include "content/public/browser/web_ui_data_source.h" |
33 #include "content/public/browser/web_ui_message_handler.h" | 33 #include "content/public/browser/web_ui_message_handler.h" |
34 #include "ui/shell_dialogs/select_file_dialog.h" | 34 #include "ui/shell_dialogs/select_file_dialog.h" |
35 | 35 |
36 #if BUILDFLAG(ANDROID_JAVA_UI) | 36 #if defined(OS_ANDROID) |
37 #include "chrome/browser/android/intent_helper.h" | 37 #include "chrome/browser/android/intent_helper.h" |
38 #endif | 38 #endif |
39 | 39 |
40 using content::BrowserThread; | 40 using content::BrowserThread; |
41 using content::WebContents; | 41 using content::WebContents; |
42 using content::WebUIMessageHandler; | 42 using content::WebUIMessageHandler; |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 // May only be accessed on the UI thread | 46 // May only be accessed on the UI thread |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 delete value; | 283 delete value; |
284 } | 284 } |
285 } | 285 } |
286 | 286 |
287 // static | 287 // static |
288 void NetExportMessageHandler::SendEmail(const base::FilePath& file_to_send) { | 288 void NetExportMessageHandler::SendEmail(const base::FilePath& file_to_send) { |
289 if (file_to_send.empty()) | 289 if (file_to_send.empty()) |
290 return; | 290 return; |
291 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 291 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
292 | 292 |
293 #if BUILDFLAG(ANDROID_JAVA_UI) | 293 #if defined(OS_ANDROID) |
294 std::string email; | 294 std::string email; |
295 std::string subject = "net_internals_log"; | 295 std::string subject = "net_internals_log"; |
296 std::string title = "Issue number: "; | 296 std::string title = "Issue number: "; |
297 std::string body = | 297 std::string body = |
298 "Please add some informative text about the network issues."; | 298 "Please add some informative text about the network issues."; |
299 base::FilePath::StringType file_to_attach(file_to_send.value()); | 299 base::FilePath::StringType file_to_attach(file_to_send.value()); |
300 chrome::android::SendEmail( | 300 chrome::android::SendEmail( |
301 base::UTF8ToUTF16(email), base::UTF8ToUTF16(subject), | 301 base::UTF8ToUTF16(email), base::UTF8ToUTF16(subject), |
302 base::UTF8ToUTF16(body), base::UTF8ToUTF16(title), | 302 base::UTF8ToUTF16(body), base::UTF8ToUTF16(title), |
303 base::UTF8ToUTF16(file_to_attach)); | 303 base::UTF8ToUTF16(file_to_attach)); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 366 |
367 } // namespace | 367 } // namespace |
368 | 368 |
369 NetExportUI::NetExportUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 369 NetExportUI::NetExportUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
370 web_ui->AddMessageHandler(new NetExportMessageHandler()); | 370 web_ui->AddMessageHandler(new NetExportMessageHandler()); |
371 | 371 |
372 // Set up the chrome://net-export/ source. | 372 // Set up the chrome://net-export/ source. |
373 Profile* profile = Profile::FromWebUI(web_ui); | 373 Profile* profile = Profile::FromWebUI(web_ui); |
374 content::WebUIDataSource::Add(profile, CreateNetExportHTMLSource()); | 374 content::WebUIDataSource::Add(profile, CreateNetExportHTMLSource()); |
375 } | 375 } |
OLD | NEW |