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

Side by Side Diff: chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc

Issue 1361253002: Separate the URL of an infobar link with clicking on it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pkasting Created 5 years, 2 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/omnibox/alternate_nav_infobar_delegate.h" 5 #include "chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" 8 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h"
9 #include "chrome/browser/history/history_service_factory.h" 9 #include "chrome/browser/history/history_service_factory.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 size_t* link_offset) const { 56 size_t* link_offset) const {
57 const base::string16 label = l10n_util::GetStringFUTF16( 57 const base::string16 label = l10n_util::GetStringFUTF16(
58 IDS_ALTERNATE_NAV_URL_VIEW_LABEL, base::string16(), link_offset); 58 IDS_ALTERNATE_NAV_URL_VIEW_LABEL, base::string16(), link_offset);
59 return label; 59 return label;
60 } 60 }
61 61
62 base::string16 AlternateNavInfoBarDelegate::GetLinkText() const { 62 base::string16 AlternateNavInfoBarDelegate::GetLinkText() const {
63 return base::UTF8ToUTF16(match_.destination_url.spec()); 63 return base::UTF8ToUTF16(match_.destination_url.spec());
64 } 64 }
65 65
66 GURL AlternateNavInfoBarDelegate::GetLinkURL() const {
67 return match_.destination_url;
68 }
69
66 bool AlternateNavInfoBarDelegate::LinkClicked( 70 bool AlternateNavInfoBarDelegate::LinkClicked(
67 WindowOpenDisposition disposition) { 71 WindowOpenDisposition disposition) {
68 // Tell the shortcuts backend to remove the shortcut it added for the original 72 // Tell the shortcuts backend to remove the shortcut it added for the original
69 // search and instead add one reflecting this navigation. 73 // search and instead add one reflecting this navigation.
70 scoped_refptr<ShortcutsBackend> shortcuts_backend( 74 scoped_refptr<ShortcutsBackend> shortcuts_backend(
71 ShortcutsBackendFactory::GetForProfile(profile_)); 75 ShortcutsBackendFactory::GetForProfile(profile_));
72 if (shortcuts_backend.get()) { // May be NULL in incognito. 76 if (shortcuts_backend.get()) { // May be NULL in incognito.
73 shortcuts_backend->DeleteShortcutsWithURL(search_url_); 77 shortcuts_backend->DeleteShortcutsWithURL(search_url_);
74 shortcuts_backend->AddOrUpdateShortcut(text_, match_); 78 shortcuts_backend->AddOrUpdateShortcut(text_, match_);
75 } 79 }
(...skipping 26 matching lines...) Expand all
102 return IDR_INFOBAR_ALT_NAV_URL; 106 return IDR_INFOBAR_ALT_NAV_URL;
103 } 107 }
104 108
105 gfx::VectorIconId AlternateNavInfoBarDelegate::GetVectorIconId() const { 109 gfx::VectorIconId AlternateNavInfoBarDelegate::GetVectorIconId() const {
106 #if defined(OS_MACOSX) 110 #if defined(OS_MACOSX)
107 return gfx::VectorIconId::VECTOR_ICON_NONE; 111 return gfx::VectorIconId::VECTOR_ICON_NONE;
108 #else 112 #else
109 return gfx::VectorIconId::GLOBE; 113 return gfx::VectorIconId::GLOBE;
110 #endif 114 #endif
111 } 115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698