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

Unified Diff: chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc

Issue 190063006: Infobar Componentization Proof of Concept (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fixes Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc
diff --git a/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc b/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc
index e09ab616a1066714c103959f925de54d6951f77f..3eb85173b88601d02c6670edf9ab584a0c9ce2bc 100644
--- a/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc
+++ b/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/history/shortcuts_backend.h"
#include "chrome/browser/history/shortcuts_backend_factory.h"
#include "chrome/browser/infobars/infobar.h"
+#include "chrome/browser/infobars/infobar_manager.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/web_contents.h"
@@ -31,17 +32,22 @@ void AlternateNavInfoBarDelegate::Create(
InfoBarService::FromWebContents(web_contents);
infobar_service->AddInfoBar(AlternateNavInfoBarDelegate::CreateInfoBar(
scoped_ptr<AlternateNavInfoBarDelegate>(new AlternateNavInfoBarDelegate(
- Profile::FromBrowserContext(web_contents->GetBrowserContext()), text,
- match, search_url))));
+ Profile::FromBrowserContext(web_contents->GetBrowserContext()),
+ web_contents,
+ text,
+ match,
+ search_url))));
}
AlternateNavInfoBarDelegate::AlternateNavInfoBarDelegate(
Profile* profile,
+ content::WebContents* web_contents,
const base::string16& text,
const AutocompleteMatch& match,
const GURL& search_url)
: InfoBarDelegate(),
profile_(profile),
+ web_contents_(web_contents),
text_(text),
match_(match),
search_url_(search_url) {
@@ -82,9 +88,11 @@ bool AlternateNavInfoBarDelegate::LinkClicked(
// Pretend the user typed this URL, so that navigating to it will be the
// default action when it's typed again in the future.
- web_contents()->OpenURL(content::OpenURLParams(
- match_.destination_url, content::Referrer(), disposition,
- content::PAGE_TRANSITION_TYPED, false));
+ web_contents_->OpenURL(content::OpenURLParams(match_.destination_url,
+ content::Referrer(),
+ disposition,
+ content::PAGE_TRANSITION_TYPED,
+ false));
// We should always close, even if the navigation did not occur within this
// WebContents.
@@ -98,3 +106,5 @@ int AlternateNavInfoBarDelegate::GetIconID() const {
InfoBarDelegate::Type AlternateNavInfoBarDelegate::GetInfoBarType() const {
return PAGE_ACTION_TYPE;
}
+
+void AlternateNavInfoBarDelegate::CleanUp() { web_contents_ = NULL; }

Powered by Google App Engine
This is Rietveld 408576698