OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/omnibox_navigation_observer.h" | 5 #include "chrome/browser/ui/omnibox/omnibox_navigation_observer.h" |
6 | 6 |
7 #include "chrome/browser/autocomplete/shortcuts_backend.h" | 7 #include "chrome/browser/autocomplete/shortcuts_backend.h" |
8 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" | 8 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" |
9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
10 #include "chrome/browser/intranet_redirect_detector.h" | 10 #include "chrome/browser/intranet_redirect_detector.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 void OmniboxNavigationObserver::NavigationEntryCommitted( | 101 void OmniboxNavigationObserver::NavigationEntryCommitted( |
102 const content::LoadCommittedDetails& load_details) { | 102 const content::LoadCommittedDetails& load_details) { |
103 load_state_ = LOAD_COMMITTED; | 103 load_state_ = LOAD_COMMITTED; |
104 if (ResponseCodeIndicatesSuccess(load_details.http_status_code) && | 104 if (ResponseCodeIndicatesSuccess(load_details.http_status_code) && |
105 IsValidNavigation(match_.destination_url, load_details.entry->GetURL())) | 105 IsValidNavigation(match_.destination_url, load_details.entry->GetURL())) |
106 OnSuccessfulNavigation(); | 106 OnSuccessfulNavigation(); |
107 if (!fetcher_ || (fetch_state_ != FETCH_NOT_COMPLETE)) | 107 if (!fetcher_ || (fetch_state_ != FETCH_NOT_COMPLETE)) |
108 OnAllLoadingFinished(); // deletes |this|! | 108 OnAllLoadingFinished(); // deletes |this|! |
109 } | 109 } |
110 | 110 |
111 void OmniboxNavigationObserver::WebContentsDestroyed( | 111 void OmniboxNavigationObserver::WebContentsDestroyed() { |
112 content::WebContents* web_contents) { | |
113 delete this; | 112 delete this; |
114 } | 113 } |
115 | 114 |
116 void OmniboxNavigationObserver::DidStartNavigationToPendingEntry( | 115 void OmniboxNavigationObserver::DidStartNavigationToPendingEntry( |
117 const GURL& url, | 116 const GURL& url, |
118 content::NavigationController::ReloadType reload_type) { | 117 content::NavigationController::ReloadType reload_type) { |
119 if (load_state_ == LOAD_NOT_SEEN) { | 118 if (load_state_ == LOAD_NOT_SEEN) { |
120 load_state_ = LOAD_PENDING; | 119 load_state_ = LOAD_PENDING; |
121 if (fetcher_) | 120 if (fetcher_) |
122 fetcher_->Start(); | 121 fetcher_->Start(); |
(...skipping 18 matching lines...) Expand all Loading... |
141 OnAllLoadingFinished(); // deletes |this|! | 140 OnAllLoadingFinished(); // deletes |this|! |
142 } | 141 } |
143 | 142 |
144 void OmniboxNavigationObserver::OnAllLoadingFinished() { | 143 void OmniboxNavigationObserver::OnAllLoadingFinished() { |
145 if (fetch_state_ == FETCH_SUCCEEDED) { | 144 if (fetch_state_ == FETCH_SUCCEEDED) { |
146 AlternateNavInfoBarDelegate::Create( | 145 AlternateNavInfoBarDelegate::Create( |
147 web_contents(), text_, alternate_nav_match_, match_.destination_url); | 146 web_contents(), text_, alternate_nav_match_, match_.destination_url); |
148 } | 147 } |
149 delete this; | 148 delete this; |
150 } | 149 } |
OLD | NEW |