| OLD | NEW |
| 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/ui/views/session_crashed_bubble_view.h" | 5 #include "chrome/browser/ui/views/session_crashed_bubble_view.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 // A helper class that listens to browser removal event. | 98 // A helper class that listens to browser removal event. |
| 99 class SessionCrashedBubbleView::BrowserRemovalObserver | 99 class SessionCrashedBubbleView::BrowserRemovalObserver |
| 100 : public chrome::BrowserListObserver { | 100 : public chrome::BrowserListObserver { |
| 101 public: | 101 public: |
| 102 explicit BrowserRemovalObserver(Browser* browser) : browser_(browser) { | 102 explicit BrowserRemovalObserver(Browser* browser) : browser_(browser) { |
| 103 DCHECK(browser_); | 103 DCHECK(browser_); |
| 104 BrowserList::AddObserver(this); | 104 BrowserList::AddObserver(this); |
| 105 } | 105 } |
| 106 | 106 |
| 107 virtual ~BrowserRemovalObserver() { | 107 ~BrowserRemovalObserver() override { BrowserList::RemoveObserver(this); } |
| 108 BrowserList::RemoveObserver(this); | |
| 109 } | |
| 110 | 108 |
| 111 // Overridden from chrome::BrowserListObserver. | 109 // Overridden from chrome::BrowserListObserver. |
| 112 virtual void OnBrowserRemoved(Browser* browser) override { | 110 void OnBrowserRemoved(Browser* browser) override { |
| 113 if (browser == browser_) | 111 if (browser == browser_) |
| 114 browser_ = NULL; | 112 browser_ = NULL; |
| 115 } | 113 } |
| 116 | 114 |
| 117 Browser* browser() const { return browser_; } | 115 Browser* browser() const { return browser_; } |
| 118 | 116 |
| 119 private: | 117 private: |
| 120 Browser* browser_; | 118 Browser* browser_; |
| 121 | 119 |
| 122 DISALLOW_COPY_AND_ASSIGN(BrowserRemovalObserver); | 120 DISALLOW_COPY_AND_ASSIGN(BrowserRemovalObserver); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 GetWidget()->Close(); | 436 GetWidget()->Close(); |
| 439 } | 437 } |
| 440 | 438 |
| 441 bool ShowSessionCrashedBubble(Browser* browser) { | 439 bool ShowSessionCrashedBubble(Browser* browser) { |
| 442 if (IsBubbleUIEnabled()) { | 440 if (IsBubbleUIEnabled()) { |
| 443 SessionCrashedBubbleView::Show(browser); | 441 SessionCrashedBubbleView::Show(browser); |
| 444 return true; | 442 return true; |
| 445 } | 443 } |
| 446 return false; | 444 return false; |
| 447 } | 445 } |
| OLD | NEW |