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

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

Issue 10206036: Crash when trying to close chrome://inspect (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
« no previous file with comments | « chrome/browser/ui/webui/inspect_ui.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 content::NotificationService::AllSources()); 390 content::NotificationService::AllSources());
391 registrar_.Add(this, 391 registrar_.Add(this,
392 content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, 392 content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED,
393 content::NotificationService::AllSources()); 393 content::NotificationService::AllSources());
394 registrar_.Add(this, 394 registrar_.Add(this,
395 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 395 content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
396 content::NotificationService::AllSources()); 396 content::NotificationService::AllSources());
397 } 397 }
398 398
399 InspectUI::~InspectUI() { 399 InspectUI::~InspectUI() {
400 observer_->InspectUIDestroyed(); 400 StopListeningNotifications();
401 observer_ = NULL;
402 } 401 }
403 402
404 void InspectUI::RefreshUI() { 403 void InspectUI::RefreshUI() {
405 web_ui()->CallJavascriptFunction("populateLists"); 404 web_ui()->CallJavascriptFunction("populateLists");
406 } 405 }
407 406
408 void InspectUI::Observe(int type, 407 void InspectUI::Observe(int type,
409 const content::NotificationSource& source, 408 const content::NotificationSource& source,
410 const content::NotificationDetails& details) { 409 const content::NotificationDetails& details) {
410 if (source == content::Source<WebContents>(web_ui()->GetWebContents())) {
411 if (type == content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED)
412 StopListeningNotifications();
413 return;
414 }
411 RefreshUI(); 415 RefreshUI();
412 } 416 }
417
418 void InspectUI::StopListeningNotifications()
419 {
420 if (!observer_)
421 return;
422 observer_->InspectUIDestroyed();
423 observer_ = NULL;
424 registrar_.RemoveAll();
425 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/inspect_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698