OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ash/chrome_new_window_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_new_window_delegate.h" |
6 | 6 |
7 #include "ash/wm/window_util.h" | 7 #include "ash/wm/window_util.h" |
8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
9 #include "chrome/browser/sessions/tab_restore_service.h" | 9 #include "chrome/browser/sessions/tab_restore_service.h" |
10 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 10 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 public: | 42 public: |
43 TabRestoreHelper(ChromeNewWindowDelegate* delegate, | 43 TabRestoreHelper(ChromeNewWindowDelegate* delegate, |
44 Profile* profile, | 44 Profile* profile, |
45 TabRestoreService* service) | 45 TabRestoreService* service) |
46 : delegate_(delegate), | 46 : delegate_(delegate), |
47 profile_(profile), | 47 profile_(profile), |
48 tab_restore_service_(service) { | 48 tab_restore_service_(service) { |
49 tab_restore_service_->AddObserver(this); | 49 tab_restore_service_->AddObserver(this); |
50 } | 50 } |
51 | 51 |
52 virtual ~TabRestoreHelper() { | 52 ~TabRestoreHelper() override { tab_restore_service_->RemoveObserver(this); } |
53 tab_restore_service_->RemoveObserver(this); | |
54 } | |
55 | 53 |
56 TabRestoreService* tab_restore_service() { return tab_restore_service_; } | 54 TabRestoreService* tab_restore_service() { return tab_restore_service_; } |
57 | 55 |
58 virtual void TabRestoreServiceChanged(TabRestoreService* service) override { | 56 void TabRestoreServiceChanged(TabRestoreService* service) override {} |
59 } | |
60 | 57 |
61 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) override { | 58 void TabRestoreServiceDestroyed(TabRestoreService* service) override { |
62 // This destroys us. | 59 // This destroys us. |
63 delegate_->tab_restore_helper_.reset(); | 60 delegate_->tab_restore_helper_.reset(); |
64 } | 61 } |
65 | 62 |
66 virtual void TabRestoreServiceLoaded(TabRestoreService* service) override { | 63 void TabRestoreServiceLoaded(TabRestoreService* service) override { |
67 RestoreTabUsingProfile(profile_); | 64 RestoreTabUsingProfile(profile_); |
68 // This destroys us. | 65 // This destroys us. |
69 delegate_->tab_restore_helper_.reset(); | 66 delegate_->tab_restore_helper_.reset(); |
70 } | 67 } |
71 | 68 |
72 private: | 69 private: |
73 ChromeNewWindowDelegate* delegate_; | 70 ChromeNewWindowDelegate* delegate_; |
74 Profile* profile_; | 71 Profile* profile_; |
75 TabRestoreService* tab_restore_service_; | 72 TabRestoreService* tab_restore_service_; |
76 | 73 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } | 119 } |
123 } | 120 } |
124 | 121 |
125 void ChromeNewWindowDelegate::ShowTaskManager() { | 122 void ChromeNewWindowDelegate::ShowTaskManager() { |
126 chrome::OpenTaskManager(NULL); | 123 chrome::OpenTaskManager(NULL); |
127 } | 124 } |
128 | 125 |
129 void ChromeNewWindowDelegate::OpenFeedbackPage() { | 126 void ChromeNewWindowDelegate::OpenFeedbackPage() { |
130 chrome::OpenFeedbackDialog(GetBrowserForActiveWindow()); | 127 chrome::OpenFeedbackDialog(GetBrowserForActiveWindow()); |
131 } | 128 } |
OLD | NEW |