OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/instant/instant_confirm_dialog.h" | 5 #include "chrome/browser/instant/instant_confirm_dialog.h" |
6 | 6 |
| 7 #include "chrome/browser/instant/instant_controller.h" |
| 8 #include "chrome/browser/instant/promo_counter.h" |
7 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
8 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
9 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
10 | 12 |
11 namespace browser { | 13 namespace browser { |
12 | 14 |
13 // TODO: get the right url. | 15 // TODO: get the right url. |
14 const char kInstantLearnMoreURL[] = "http://www.google.com"; | 16 const char kInstantLearnMoreURL[] = "http://www.google.com"; |
15 | 17 |
16 void ShowInstantConfirmDialogIfNecessary(gfx::NativeWindow parent, | 18 void ShowInstantConfirmDialogIfNecessary(gfx::NativeWindow parent, |
17 Profile* profile) { | 19 Profile* profile) { |
18 PrefService* prefs = profile->GetPrefs(); | 20 PrefService* prefs = profile->GetPrefs(); |
19 if (!prefs) | 21 if (!prefs) |
20 return; | 22 return; |
21 | 23 |
| 24 PromoCounter* promo_counter = profile->GetInstantPromoCounter(); |
| 25 if (promo_counter) |
| 26 promo_counter->Hide(); |
| 27 |
22 if (prefs->GetBoolean(prefs::kInstantConfirmDialogShown)) { | 28 if (prefs->GetBoolean(prefs::kInstantConfirmDialogShown)) { |
23 prefs->SetBoolean(prefs::kInstantEnabled, true); | 29 InstantController::Enable(profile); |
24 return; | 30 return; |
25 } | 31 } |
26 | 32 |
27 ShowInstantConfirmDialog(parent, profile); | 33 ShowInstantConfirmDialog(parent, profile); |
28 } | 34 } |
29 | 35 |
30 #if !defined(TOOLKIT_VIEWS) && !defined(TOOLKIT_GTK) | 36 #if !defined(TOOLKIT_VIEWS) && !defined(TOOLKIT_GTK) |
31 void ShowInstantConfirmDialog(gfx::NativeWindow parent, | 37 void ShowInstantConfirmDialog(gfx::NativeWindow parent, |
32 Profile* profile) { | 38 Profile* profile) { |
33 NOTIMPLEMENTED(); | 39 NOTIMPLEMENTED(); |
34 } | 40 } |
35 #endif | 41 #endif |
36 | 42 |
37 } // namespace browser | 43 } // namespace browser |
OLD | NEW |