• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #include "chrome/browser/instant/instant_confirm_dialog.h"
6 
7 #include "chrome/browser/instant/instant_controller.h"
8 #include "chrome/browser/instant/promo_counter.h"
9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/common/pref_names.h"
12 #include "googleurl/src/gurl.h"
13 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h"
15 
16 namespace browser {
17 
InstantLearnMoreURL()18 GURL InstantLearnMoreURL() {
19   return GURL(l10n_util::GetStringUTF8(IDS_INSTANT_LEARN_MORE_URL));
20 }
21 
ShowInstantConfirmDialogIfNecessary(gfx::NativeWindow parent,Profile * profile)22 void ShowInstantConfirmDialogIfNecessary(gfx::NativeWindow parent,
23                                          Profile* profile) {
24   PrefService* prefs = profile->GetPrefs();
25   if (!prefs)
26     return;
27 
28   PromoCounter* promo_counter = profile->GetInstantPromoCounter();
29   if (promo_counter)
30     promo_counter->Hide();
31 
32   if (prefs->GetBoolean(prefs::kInstantConfirmDialogShown)) {
33     InstantController::Enable(profile);
34     return;
35   }
36 
37   ShowInstantConfirmDialog(parent, profile);
38 }
39 
40 }  // namespace browser
41