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

Side by Side Diff: chrome/browser/alternate_nav_url_fetcher.cc

Issue 6249010: Cleanup: de-inline a bunch of classes, rename and move "PluginInstaller" to "... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/alternate_nav_url_fetcher.h" 5 #include "chrome/browser/alternate_nav_url_fetcher.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/intranet_redirect_detector.h" 9 #include "chrome/browser/intranet_redirect_detector.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 const GURL& url, 91 const GURL& url,
92 const net::URLRequestStatus& status, 92 const net::URLRequestStatus& status,
93 int response_code, 93 int response_code,
94 const ResponseCookies& cookies, 94 const ResponseCookies& cookies,
95 const std::string& data) { 95 const std::string& data) {
96 DCHECK(fetcher_.get() == source); 96 DCHECK(fetcher_.get() == source);
97 SetStatusFromURLFetch(url, status, response_code); 97 SetStatusFromURLFetch(url, status, response_code);
98 ShowInfobarIfPossible(); 98 ShowInfobarIfPossible();
99 } 99 }
100 100
101 SkBitmap* AlternateNavURLFetcher::GetIcon() const {
102 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
103 IDR_INFOBAR_ALT_NAV_URL);
104 }
105
101 string16 AlternateNavURLFetcher::GetMessageTextWithOffset( 106 string16 AlternateNavURLFetcher::GetMessageTextWithOffset(
102 size_t* link_offset) const { 107 size_t* link_offset) const {
103 const string16 label = l10n_util::GetStringFUTF16( 108 const string16 label = l10n_util::GetStringFUTF16(
104 IDS_ALTERNATE_NAV_URL_VIEW_LABEL, string16(), link_offset); 109 IDS_ALTERNATE_NAV_URL_VIEW_LABEL, string16(), link_offset);
105 DCHECK(*link_offset != string16::npos); 110 DCHECK(*link_offset != string16::npos);
106 return label; 111 return label;
107 } 112 }
108 113
109 string16 AlternateNavURLFetcher::GetLinkText() const { 114 string16 AlternateNavURLFetcher::GetLinkText() const {
110 return UTF8ToUTF16(alternate_nav_url_.spec()); 115 return UTF8ToUTF16(alternate_nav_url_.spec());
111 } 116 }
112 117
113 SkBitmap* AlternateNavURLFetcher::GetIcon() const {
114 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
115 IDR_INFOBAR_ALT_NAV_URL);
116 }
117
118 bool AlternateNavURLFetcher::LinkClicked(WindowOpenDisposition disposition) { 118 bool AlternateNavURLFetcher::LinkClicked(WindowOpenDisposition disposition) {
119 infobar_contents_->OpenURL( 119 infobar_contents_->OpenURL(
120 alternate_nav_url_, GURL(), disposition, 120 alternate_nav_url_, GURL(), disposition,
121 // Pretend the user typed this URL, so that navigating to 121 // Pretend the user typed this URL, so that navigating to
122 // it will be the default action when it's typed again in 122 // it will be the default action when it's typed again in
123 // the future. 123 // the future.
124 PageTransition::TYPED); 124 PageTransition::TYPED);
125 125
126 // We should always close, even if the navigation did not occur within this 126 // We should always close, even if the navigation did not occur within this
127 // TabContents. 127 // TabContents.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 if (state_ == FAILED) 162 if (state_ == FAILED)
163 delete this; 163 delete this;
164 return; 164 return;
165 } 165 }
166 166
167 infobar_contents_ = controller_->tab_contents(); 167 infobar_contents_ = controller_->tab_contents();
168 StoreActiveEntryUniqueID(infobar_contents_); 168 StoreActiveEntryUniqueID(infobar_contents_);
169 // We will be deleted when the InfoBar is destroyed. (See InfoBarClosed). 169 // We will be deleted when the InfoBar is destroyed. (See InfoBarClosed).
170 infobar_contents_->AddInfoBar(this); 170 infobar_contents_->AddInfoBar(this);
171 } 171 }
OLDNEW
« no previous file with comments | « chrome/browser/alternate_nav_url_fetcher.h ('k') | chrome/browser/autofill/autofill_cc_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698