| OLD | NEW |
| 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/protector/settings_change_global_error.h" | 5 #include "chrome/browser/protector/settings_change_global_error.h" |
| 6 | 6 |
| 7 #include <bitset> | 7 #include <bitset> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 string16 SettingsChangeGlobalError::GetBubbleViewAcceptButtonLabel() { | 159 string16 SettingsChangeGlobalError::GetBubbleViewAcceptButtonLabel() { |
| 160 return change_->GetDiscardButtonText(); | 160 return change_->GetDiscardButtonText(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 string16 SettingsChangeGlobalError::GetBubbleViewCancelButtonLabel() { | 163 string16 SettingsChangeGlobalError::GetBubbleViewCancelButtonLabel() { |
| 164 return change_->GetApplyButtonText(); | 164 return change_->GetApplyButtonText(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void SettingsChangeGlobalError::OnBubbleViewDidClose(Browser* browser) { | 167 void SettingsChangeGlobalError::OnBubbleViewDidClose(Browser* browser) { |
| 168 // The bubble may be closed as the result of RemoveFromProfile call when |
| 169 // merging this error with another one. |
| 170 if (!profile_) |
| 171 return; |
| 168 if (!closed_by_button_) { | 172 if (!closed_by_button_) { |
| 169 BrowserThread::PostDelayedTask( | 173 BrowserThread::PostDelayedTask( |
| 170 BrowserThread::UI, FROM_HERE, | 174 BrowserThread::UI, FROM_HERE, |
| 171 base::Bind(&SettingsChangeGlobalError::OnInactiveTimeout, | 175 base::Bind(&SettingsChangeGlobalError::OnInactiveTimeout, |
| 172 weak_factory_.GetWeakPtr()), | 176 weak_factory_.GetWeakPtr()), |
| 173 base::TimeDelta::FromMilliseconds(kMenuItemDisplayPeriodMs)); | 177 base::TimeDelta::FromMilliseconds(kMenuItemDisplayPeriodMs)); |
| 174 #if !defined(TOOLKIT_GTK) | 178 #if !defined(TOOLKIT_GTK) |
| 175 // TODO(ivankr): the logic for redisplaying bubble is disabled on Gtk, see | 179 // TODO(ivankr): the logic for redisplaying bubble is disabled on Gtk, see |
| 176 // http://crbug.com/115719. | 180 // http://crbug.com/115719. |
| 177 if (browser->window() && | 181 if (browser->window() && |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 weak_factory_.InvalidateWeakPtrs(); | 226 weak_factory_.InvalidateWeakPtrs(); |
| 223 ShowBubbleView(browser); | 227 ShowBubbleView(browser); |
| 224 } | 228 } |
| 225 | 229 |
| 226 void SettingsChangeGlobalError::OnInactiveTimeout() { | 230 void SettingsChangeGlobalError::OnInactiveTimeout() { |
| 227 delegate_->OnDecisionTimeout(this); | 231 delegate_->OnDecisionTimeout(this); |
| 228 RemoveFromProfile(); | 232 RemoveFromProfile(); |
| 229 } | 233 } |
| 230 | 234 |
| 231 } // namespace protector | 235 } // namespace protector |
| OLD | NEW |