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

Side by Side Diff: chrome/browser/ui/webui/inspect_ui.cc

Issue 10890023: Miscellaneous cleanups from several months ago I never got around to landing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/ui/webui/inspect_ui.h" 5 #include "chrome/browser/ui/webui/inspect_ui.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 StopListeningNotifications(); 397 StopListeningNotifications();
398 } 398 }
399 399
400 void InspectUI::RefreshUI() { 400 void InspectUI::RefreshUI() {
401 web_ui()->CallJavascriptFunction("populateLists"); 401 web_ui()->CallJavascriptFunction("populateLists");
402 } 402 }
403 403
404 void InspectUI::Observe(int type, 404 void InspectUI::Observe(int type,
405 const content::NotificationSource& source, 405 const content::NotificationSource& source,
406 const content::NotificationDetails& details) { 406 const content::NotificationDetails& details) {
407 if (source == content::Source<WebContents>(web_ui()->GetWebContents())) { 407 if (source != content::Source<WebContents>(web_ui()->GetWebContents()))
408 if (type == content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED) 408 RefreshUI();
409 StopListeningNotifications(); 409 else if (type == content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED)
410 return; 410 StopListeningNotifications();
411 }
412 RefreshUI();
413 } 411 }
414 412
415 void InspectUI::StopListeningNotifications() 413 void InspectUI::StopListeningNotifications()
416 { 414 {
417 if (!observer_) 415 if (!observer_)
418 return; 416 return;
419 observer_->InspectUIDestroyed(); 417 observer_->InspectUIDestroyed();
420 observer_ = NULL; 418 observer_ = NULL;
421 registrar_.RemoveAll(); 419 registrar_.RemoveAll();
422 } 420 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tabs/tab_strip_model_unittest.cc ('k') | chrome/common/chrome_notification_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698