Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: chrome/browser/intents/register_intent_handler_infobar_delegate.cc

Issue 8144013: Add a check to the registry before the intent infobar is shown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix provider to service in comments. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/intents/register_intent_handler_infobar_delegate.h" 5 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h"
6 6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/infobars/infobar_tab_helper.h"
9 #include "chrome/browser/intents/web_intents_registry.h" 12 #include "chrome/browser/intents/web_intents_registry.h"
10 #include "chrome/browser/intents/web_intents_registry_factory.h" 13 #include "chrome/browser/intents/web_intents_registry_factory.h"
11 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
12 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
13 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
14 17
15 RegisterIntentHandlerInfoBarDelegate::RegisterIntentHandlerInfoBarDelegate( 18 RegisterIntentHandlerInfoBarDelegate::RegisterIntentHandlerInfoBarDelegate(
16 InfoBarTabHelper* infobar_helper, 19 InfoBarTabHelper* infobar_helper,
17 WebIntentsRegistry* registry, 20 WebIntentsRegistry* registry,
18 const webkit_glue::WebIntentServiceData& service) 21 const webkit_glue::WebIntentServiceData& service)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); 56 return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
54 } 57 }
55 58
56 bool RegisterIntentHandlerInfoBarDelegate::LinkClicked( 59 bool RegisterIntentHandlerInfoBarDelegate::LinkClicked(
57 WindowOpenDisposition disposition) { 60 WindowOpenDisposition disposition) {
58 // TODO(jhawkins): Open the Web Intents Help Center article once it is 61 // TODO(jhawkins): Open the Web Intents Help Center article once it is
59 // written. 62 // written.
60 // TODO(jhawkins): Add associated bug for the article here. 63 // TODO(jhawkins): Add associated bug for the article here.
61 return false; 64 return false;
62 } 65 }
66
67 namespace {
68
69 // Helper continuation for MaybeShowIntentInfoBar.
70 void CheckProvider(InfoBarTabHelper* infobar_helper,
71 WebIntentsRegistry* registry,
72 const webkit_glue::WebIntentServiceData& service,
73 bool provider_exists) {
74 if (!provider_exists) {
75 infobar_helper->AddInfoBar(new RegisterIntentHandlerInfoBarDelegate(
76 infobar_helper, registry, service));
77 }
78 }
79
80 } // namespace
81
82 // static
83 void RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar(
84 InfoBarTabHelper* infobar_helper,
85 WebIntentsRegistry* registry,
86 const webkit_glue::WebIntentServiceData& service) {
87 DCHECK(infobar_helper);
88 DCHECK(registry);
89 registry->IntentProviderExists(service,
90 base::Bind(&CheckProvider,
91 base::Unretained(infobar_helper),
92 registry,
93 service));
94 }
OLDNEW
« no previous file with comments | « chrome/browser/intents/register_intent_handler_infobar_delegate.h ('k') | chrome/browser/intents/web_intents_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698