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

Side by Side Diff: chrome/browser/task_manager/web_contents_information.cc

Issue 2063863002: Use DCHECKs when observing only a single notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 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 "chrome/browser/task_manager/web_contents_information.h" 5 #include "chrome/browser/task_manager/web_contents_information.h"
6 #include "content/public/browser/notification_service.h" 6 #include "content/public/browser/notification_service.h"
7 #include "content/public/browser/notification_types.h" 7 #include "content/public/browser/notification_types.h"
8 8
9 namespace task_manager { 9 namespace task_manager {
10 10
(...skipping 20 matching lines...) Expand all
31 this, 31 this,
32 content::NOTIFICATION_WEB_CONTENTS_CONNECTED, 32 content::NOTIFICATION_WEB_CONTENTS_CONNECTED,
33 content::NotificationService::AllBrowserContextsAndSources()); 33 content::NotificationService::AllBrowserContextsAndSources());
34 observer_callback_.Reset(); 34 observer_callback_.Reset();
35 } 35 }
36 36
37 void NotificationObservingWebContentsInformation::Observe( 37 void NotificationObservingWebContentsInformation::Observe(
38 int type, 38 int type,
39 const content::NotificationSource& source, 39 const content::NotificationSource& source,
40 const content::NotificationDetails& details) { 40 const content::NotificationDetails& details) {
41 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_CONNECTED, type);
42
41 content::WebContents* web_contents = 43 content::WebContents* web_contents =
42 content::Source<content::WebContents>(source).ptr(); 44 content::Source<content::WebContents>(source).ptr();
43 45 if (CheckOwnership(web_contents))
44 switch (type) { 46 observer_callback_.Run(web_contents);
45 case content::NOTIFICATION_WEB_CONTENTS_CONNECTED:
46 if (CheckOwnership(web_contents))
47 observer_callback_.Run(web_contents);
48 break;
49 }
50 } 47 }
51 48
52 } // namespace task_manager 49 } // namespace task_manager
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_error_handler.cc ('k') | chrome/browser/web_applications/update_shortcut_worker_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698