| OLD | NEW |
| 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 "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" | 9 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" |
| 10 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // static | 25 // static |
| 26 void AlternateNavInfoBarDelegate::Create( | 26 void AlternateNavInfoBarDelegate::Create( |
| 27 content::WebContents* web_contents, | 27 content::WebContents* web_contents, |
| 28 const base::string16& text, | 28 const base::string16& text, |
| 29 const AutocompleteMatch& match, | 29 const AutocompleteMatch& match, |
| 30 const GURL& search_url) { | 30 const GURL& search_url) { |
| 31 InfoBarService* infobar_service = | 31 InfoBarService* infobar_service = |
| 32 InfoBarService::FromWebContents(web_contents); | 32 InfoBarService::FromWebContents(web_contents); |
| 33 infobar_service->AddInfoBar(AlternateNavInfoBarDelegate::CreateInfoBar( | 33 infobar_service->AddInfoBar(AlternateNavInfoBarDelegate::CreateInfoBar( |
| 34 scoped_ptr<AlternateNavInfoBarDelegate>(new AlternateNavInfoBarDelegate( | 34 std::unique_ptr<AlternateNavInfoBarDelegate>( |
| 35 Profile::FromBrowserContext(web_contents->GetBrowserContext()), text, | 35 new AlternateNavInfoBarDelegate( |
| 36 match, search_url)))); | 36 Profile::FromBrowserContext(web_contents->GetBrowserContext()), |
| 37 text, match, search_url)))); |
| 37 } | 38 } |
| 38 | 39 |
| 39 AlternateNavInfoBarDelegate::AlternateNavInfoBarDelegate( | 40 AlternateNavInfoBarDelegate::AlternateNavInfoBarDelegate( |
| 40 Profile* profile, | 41 Profile* profile, |
| 41 const base::string16& text, | 42 const base::string16& text, |
| 42 const AutocompleteMatch& match, | 43 const AutocompleteMatch& match, |
| 43 const GURL& search_url) | 44 const GURL& search_url) |
| 44 : infobars::InfoBarDelegate(), | 45 : infobars::InfoBarDelegate(), |
| 45 profile_(profile), | 46 profile_(profile), |
| 46 text_(text), | 47 text_(text), |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 return IDR_INFOBAR_ALT_NAV_URL; | 113 return IDR_INFOBAR_ALT_NAV_URL; |
| 113 } | 114 } |
| 114 | 115 |
| 115 gfx::VectorIconId AlternateNavInfoBarDelegate::GetVectorIconId() const { | 116 gfx::VectorIconId AlternateNavInfoBarDelegate::GetVectorIconId() const { |
| 116 #if defined(OS_MACOSX) | 117 #if defined(OS_MACOSX) |
| 117 return gfx::VectorIconId::VECTOR_ICON_NONE; | 118 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 118 #else | 119 #else |
| 119 return gfx::VectorIconId::GLOBE; | 120 return gfx::VectorIconId::GLOBE; |
| 120 #endif | 121 #endif |
| 121 } | 122 } |
| OLD | NEW |