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

Side by Side Diff: components/password_manager/core/browser/log_router.cc

Issue 269513003: Password manager internals page service: wiring it in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding forgotten s/NotifyCanUseLogRouter/OnLogRouterAvailabilityChanged in tests Created 6 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/password_manager/core/browser/log_router.h" 5 #include "components/password_manager/core/browser/log_router.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "components/password_manager/core/browser/password_manager_client.h" 8 #include "components/password_manager/core/browser/password_manager_client.h"
9 #include "components/password_manager/core/browser/password_manager_logger.h" 9 #include "components/password_manager/core/browser/password_manager_logger.h"
10 10
(...skipping 22 matching lines...) Expand all
33 33
34 void LogRouter::UnregisterClient(PasswordManagerClient* client) { 34 void LogRouter::UnregisterClient(PasswordManagerClient* client) {
35 DCHECK(clients_.HasObserver(client)); 35 DCHECK(clients_.HasObserver(client));
36 clients_.RemoveObserver(client); 36 clients_.RemoveObserver(client);
37 } 37 }
38 38
39 std::string LogRouter::RegisterReceiver(PasswordManagerLogger* receiver) { 39 std::string LogRouter::RegisterReceiver(PasswordManagerLogger* receiver) {
40 DCHECK(receiver); 40 DCHECK(receiver);
41 DCHECK(accumulated_logs_.empty() || receivers_.might_have_observers()); 41 DCHECK(accumulated_logs_.empty() || receivers_.might_have_observers());
42 42
43 // TODO(vabr): Once the clients provide API for that, notify them if the 43 if (!receivers_.might_have_observers()) {
44 // number of receivers went from 0 to 1. 44 FOR_EACH_OBSERVER(
45 PasswordManagerClient, clients_, OnLogRouterAvailabilityChanged(true));
46 }
45 receivers_.AddObserver(receiver); 47 receivers_.AddObserver(receiver);
46 return accumulated_logs_; 48 return accumulated_logs_;
47 } 49 }
48 50
49 void LogRouter::UnregisterReceiver(PasswordManagerLogger* receiver) { 51 void LogRouter::UnregisterReceiver(PasswordManagerLogger* receiver) {
50 DCHECK(receivers_.HasObserver(receiver)); 52 DCHECK(receivers_.HasObserver(receiver));
51 receivers_.RemoveObserver(receiver); 53 receivers_.RemoveObserver(receiver);
52 if (!receivers_.might_have_observers()) { 54 if (!receivers_.might_have_observers()) {
53 accumulated_logs_.clear(); 55 accumulated_logs_.clear();
54 // TODO(vabr): Once the clients provide API for that, notify them that the 56 FOR_EACH_OBSERVER(
55 // number of receivers went from 1 to 0. 57 PasswordManagerClient, clients_, OnLogRouterAvailabilityChanged(false));
56 } 58 }
57 } 59 }
58 60
59 } // namespace password_manager 61 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698