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

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

Issue 7930002: Rename WebIntentData for backend storage to WebIntentServiceData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix class/struct decl Created 9 years, 3 months 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/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/intents/web_intents_registry.h" 9 #include "chrome/browser/intents/web_intents_registry.h"
10 #include "chrome/browser/intents/web_intents_registry_factory.h" 10 #include "chrome/browser/intents/web_intents_registry_factory.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "content/browser/tab_contents/tab_contents.h" 12 #include "content/browser/tab_contents/tab_contents.h"
13 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
15 15
16 RegisterIntentHandlerInfoBarDelegate::RegisterIntentHandlerInfoBarDelegate( 16 RegisterIntentHandlerInfoBarDelegate::RegisterIntentHandlerInfoBarDelegate(
17 TabContents* tab_contents, const WebIntentData& intent) 17 TabContents* tab_contents, const WebIntentServiceData& service)
18 : ConfirmInfoBarDelegate(tab_contents), 18 : ConfirmInfoBarDelegate(tab_contents),
19 tab_contents_(tab_contents), 19 tab_contents_(tab_contents),
20 profile_(Profile::FromBrowserContext(tab_contents->browser_context())), 20 profile_(Profile::FromBrowserContext(tab_contents->browser_context())),
21 intent_(intent) { 21 service_(service) {
22 } 22 }
23 23
24 InfoBarDelegate::Type 24 InfoBarDelegate::Type
25 RegisterIntentHandlerInfoBarDelegate::GetInfoBarType() const { 25 RegisterIntentHandlerInfoBarDelegate::GetInfoBarType() const {
26 return PAGE_ACTION_TYPE; 26 return PAGE_ACTION_TYPE;
27 } 27 }
28 28
29 string16 RegisterIntentHandlerInfoBarDelegate::GetMessageText() const { 29 string16 RegisterIntentHandlerInfoBarDelegate::GetMessageText() const {
30 return l10n_util::GetStringFUTF16( 30 return l10n_util::GetStringFUTF16(
31 IDS_REGISTER_INTENT_HANDLER_CONFIRM, 31 IDS_REGISTER_INTENT_HANDLER_CONFIRM,
32 intent_.title, 32 service_.title,
33 UTF8ToUTF16(intent_.service_url.host())); 33 UTF8ToUTF16(service_.service_url.host()));
34 } 34 }
35 35
36 string16 RegisterIntentHandlerInfoBarDelegate::GetButtonLabel( 36 string16 RegisterIntentHandlerInfoBarDelegate::GetButtonLabel(
37 InfoBarButton button) const { 37 InfoBarButton button) const {
38 if (button == BUTTON_OK) { 38 if (button == BUTTON_OK) {
39 return l10n_util::GetStringFUTF16(IDS_REGISTER_INTENT_HANDLER_ACCEPT, 39 return l10n_util::GetStringFUTF16(IDS_REGISTER_INTENT_HANDLER_ACCEPT,
40 UTF8ToUTF16(intent_.service_url.host())); 40 UTF8ToUTF16(service_.service_url.host()));
41 } 41 }
42 42
43 DCHECK(button == BUTTON_CANCEL); 43 DCHECK(button == BUTTON_CANCEL);
44 return l10n_util::GetStringUTF16(IDS_REGISTER_INTENT_HANDLER_DENY); 44 return l10n_util::GetStringUTF16(IDS_REGISTER_INTENT_HANDLER_DENY);
45 } 45 }
46 46
47 bool RegisterIntentHandlerInfoBarDelegate::Accept() { 47 bool RegisterIntentHandlerInfoBarDelegate::Accept() {
48 WebIntentsRegistry* registry = 48 WebIntentsRegistry* registry =
49 WebIntentsRegistryFactory::GetForProfile(profile_); 49 WebIntentsRegistryFactory::GetForProfile(profile_);
50 registry->RegisterIntentProvider(intent_); 50 registry->RegisterIntentProvider(service_);
51 return true; 51 return true;
52 } 52 }
53 53
54 string16 RegisterIntentHandlerInfoBarDelegate::GetLinkText() const { 54 string16 RegisterIntentHandlerInfoBarDelegate::GetLinkText() const {
55 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); 55 return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
56 } 56 }
57 57
58 bool RegisterIntentHandlerInfoBarDelegate::LinkClicked( 58 bool RegisterIntentHandlerInfoBarDelegate::LinkClicked(
59 WindowOpenDisposition disposition) { 59 WindowOpenDisposition disposition) {
60 // TODO(jhawkins): Open the Web Intents Help Center article once it is 60 // TODO(jhawkins): Open the Web Intents Help Center article once it is
61 // written. 61 // written.
62 // TODO(jhawkins): Add associated bug for the article here. 62 // TODO(jhawkins): Add associated bug for the article here.
63 return false; 63 return false;
64 } 64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698