| 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/ui/startup/default_browser_prompt.h" | 5 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 6 | 6 |
| 7 #include "base/location.h" |
| 7 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" |
| 12 #include "base/version.h" | 14 #include "base/version.h" |
| 13 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/first_run/first_run.h" | 16 #include "chrome/browser/first_run/first_run.h" |
| 15 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/shell_integration.h" | 19 #include "chrome/browser/shell_integration.h" |
| 18 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/browser_finder.h" | 21 #include "chrome/browser/ui/browser_finder.h" |
| 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 21 #include "chrome/common/chrome_version_info.h" | 23 #include "chrome/common/chrome_version_info.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 PrefService* prefs, | 115 PrefService* prefs, |
| 114 bool interactive_flow_required) | 116 bool interactive_flow_required) |
| 115 : ConfirmInfoBarDelegate(), | 117 : ConfirmInfoBarDelegate(), |
| 116 prefs_(prefs), | 118 prefs_(prefs), |
| 117 action_taken_(false), | 119 action_taken_(false), |
| 118 should_expire_(false), | 120 should_expire_(false), |
| 119 interactive_flow_required_(interactive_flow_required), | 121 interactive_flow_required_(interactive_flow_required), |
| 120 weak_factory_(this) { | 122 weak_factory_(this) { |
| 121 // We want the info-bar to stick-around for few seconds and then be hidden | 123 // We want the info-bar to stick-around for few seconds and then be hidden |
| 122 // on the next navigation after that. | 124 // on the next navigation after that. |
| 123 base::MessageLoop::current()->PostDelayedTask( | 125 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 124 FROM_HERE, | 126 FROM_HERE, base::Bind(&DefaultBrowserInfoBarDelegate::AllowExpiry, |
| 125 base::Bind(&DefaultBrowserInfoBarDelegate::AllowExpiry, | 127 weak_factory_.GetWeakPtr()), |
| 126 weak_factory_.GetWeakPtr()), | |
| 127 base::TimeDelta::FromSeconds(8)); | 128 base::TimeDelta::FromSeconds(8)); |
| 128 } | 129 } |
| 129 | 130 |
| 130 DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() { | 131 DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() { |
| 131 if (!action_taken_) | 132 if (!action_taken_) |
| 132 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.Ignored", 1); | 133 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.Ignored", 1); |
| 133 } | 134 } |
| 134 | 135 |
| 135 int DefaultBrowserInfoBarDelegate::GetIconID() const { | 136 int DefaultBrowserInfoBarDelegate::GetIconID() const { |
| 136 return IDR_PRODUCT_LOGO_32; | 137 return IDR_PRODUCT_LOGO_32; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 base::Bind(&CheckDefaultBrowserCallback, desktop_type)); | 257 base::Bind(&CheckDefaultBrowserCallback, desktop_type)); |
| 257 } | 258 } |
| 258 | 259 |
| 259 #if !defined(OS_WIN) | 260 #if !defined(OS_WIN) |
| 260 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) { | 261 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) { |
| 261 return false; | 262 return false; |
| 262 } | 263 } |
| 263 #endif | 264 #endif |
| 264 | 265 |
| 265 } // namespace chrome | 266 } // namespace chrome |
| OLD | NEW |