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

Side by Side Diff: chrome/browser/safe_browsing/srt_chrome_prompt_impl.cc

Issue 2834613003: Adds error handling support for the SwReporter launcher. (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/safe_browsing/srt_chrome_prompt_impl.h" 5 #include "chrome/browser/safe_browsing/srt_chrome_prompt_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace safe_browsing { 9 namespace safe_browsing {
10 10
11 using chrome_cleaner::mojom::ChromePrompt; 11 using chrome_cleaner::mojom::ChromePrompt;
12 using chrome_cleaner::mojom::ChromePromptRequest; 12 using chrome_cleaner::mojom::ChromePromptRequest;
13 using chrome_cleaner::mojom::ElevationStatus; 13 using chrome_cleaner::mojom::ElevationStatus;
14 using chrome_cleaner::mojom::PromptAcceptance; 14 using chrome_cleaner::mojom::PromptAcceptance;
15 using chrome_cleaner::mojom::UwSPtr; 15 using chrome_cleaner::mojom::UwSPtr;
16 16
17 ChromePromptImpl::ChromePromptImpl(ChromePromptRequest request) 17 ChromePromptImpl::ChromePromptImpl(ChromePromptRequest request)
18 : binding_(this, std::move(request)) {} 18 : binding_(this, std::move(request)) {
19 binding_.set_connection_error_handler(base::Bind(
20 &ChromePromptImpl::OnConnectionClosed, base::Unretained(this)));
grt (UTC plus 2) 2017/04/21 11:10:58 please document why Unretained is safe
ftirelo 2017/04/24 15:47:45 Obsolete.
21 }
19 22
20 ChromePromptImpl::~ChromePromptImpl() {} 23 ChromePromptImpl::~ChromePromptImpl() {}
21 24
22 void ChromePromptImpl::PromptUser( 25 void ChromePromptImpl::PromptUser(
23 std::vector<UwSPtr> removable_uws_found, 26 std::vector<UwSPtr> removable_uws_found,
24 ElevationStatus elevation_status, 27 ElevationStatus elevation_status,
25 const ChromePrompt::PromptUserCallback& callback) { 28 const ChromePrompt::PromptUserCallback& callback) {
29 if (test_delegate_)
30 test_delegate_->OnPromptUser();
31
26 // Placeholder. The actual implementation will show the prompt dialog to the 32 // Placeholder. The actual implementation will show the prompt dialog to the
27 // user and invoke this callback depending on the user's response. 33 // user and invoke this callback depending on the user's response.
28 callback.Run(PromptAcceptance::DENIED); 34 callback.Run(PromptAcceptance::DENIED);
29 } 35 }
30 36
37 void ChromePromptImpl::OnConnectionClosed() {
38 // Placeholder. This should handle cases when the reporter process is
39 // disconnected (e.g. due to a crash) and the prompt dialog is being shown
40 // to the user.
41 }
42
43 void ChromePromptImpl::OnConnectionError(const std::string& message) {
44 if (test_delegate_)
45 test_delegate_->OnConnectionError();
46
47 // Placeholder. This should handle cases when the reporter process sends
48 // a bad message and the prompt dialog is being shown to the user.
49 }
50
51 // static
52 void ChromePromptImpl::SetTestDelegate(
53 ChromePromptImpl::TestDelegate* test_delegate) {
54 test_delegate_ = test_delegate;
55 }
56
57 // static
58 ChromePromptImpl::TestDelegate* ChromePromptImpl::test_delegate_ = nullptr;
59
31 } // namespace safe_browsing 60 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698