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

Side by Side Diff: content/browser/tab_contents/navigation_controller.cc

Issue 8760024: Cross-process postMessage (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years 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 (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 "content/browser/tab_contents/navigation_controller.h" 5 #include "content/browser/tab_contents/navigation_controller.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_number_conversions.h" // Temporary 9 #include "base/string_number_conversions.h" // Temporary
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 218 }
219 219
220 bool NavigationController::IsInitialNavigation() { 220 bool NavigationController::IsInitialNavigation() {
221 return last_document_loaded_.is_null(); 221 return last_document_loaded_.is_null();
222 } 222 }
223 223
224 // static 224 // static
225 NavigationEntry* NavigationController::CreateNavigationEntry( 225 NavigationEntry* NavigationController::CreateNavigationEntry(
226 const GURL& url, const GURL& referrer, content::PageTransition transition, 226 const GURL& url, const GURL& referrer, content::PageTransition transition,
227 bool is_renderer_initiated, const std::string& extra_headers, 227 bool is_renderer_initiated, const std::string& extra_headers,
228 content::BrowserContext* browser_context) { 228 content::BrowserContext* browser_context,
229 int64 opener_browsing_instance_frame_id) {
229 // Allow the browser URL handler to rewrite the URL. This will, for example, 230 // Allow the browser URL handler to rewrite the URL. This will, for example,
230 // remove "view-source:" from the beginning of the URL to get the URL that 231 // remove "view-source:" from the beginning of the URL to get the URL that
231 // will actually be loaded. This real URL won't be shown to the user, just 232 // will actually be loaded. This real URL won't be shown to the user, just
232 // used internally. 233 // used internally.
233 GURL loaded_url(url); 234 GURL loaded_url(url);
234 bool reverse_on_redirect = false; 235 bool reverse_on_redirect = false;
235 BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( 236 BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
236 &loaded_url, browser_context, &reverse_on_redirect); 237 &loaded_url, browser_context, &reverse_on_redirect);
237 238
238 NavigationEntry* entry = new NavigationEntry( 239 NavigationEntry* entry = new NavigationEntry(
239 NULL, // The site instance for tabs is sent on navigation 240 NULL, // The site instance for tabs is sent on navigation
240 // (TabContents::GetSiteInstance). 241 // (TabContents::GetSiteInstance).
241 -1, 242 -1,
242 loaded_url, 243 loaded_url,
243 referrer, 244 referrer,
244 string16(), 245 string16(),
245 transition, 246 transition,
246 is_renderer_initiated); 247 is_renderer_initiated);
247 entry->set_virtual_url(url); 248 entry->set_virtual_url(url);
248 entry->set_user_typed_url(url); 249 entry->set_user_typed_url(url);
249 entry->set_update_virtual_url_with_url(reverse_on_redirect); 250 entry->set_update_virtual_url_with_url(reverse_on_redirect);
250 entry->set_extra_headers(extra_headers); 251 entry->set_extra_headers(extra_headers);
252 entry->set_opener_browsing_instance_frame_id(
253 opener_browsing_instance_frame_id);
251 return entry; 254 return entry;
252 } 255 }
253 256
254 NavigationEntry* NavigationController::GetEntryWithPageID( 257 NavigationEntry* NavigationController::GetEntryWithPageID(
255 SiteInstance* instance, int32 page_id) const { 258 SiteInstance* instance, int32 page_id) const {
256 int index = GetEntryIndexWithPageID(instance, page_id); 259 int index = GetEntryIndexWithPageID(instance, page_id);
257 return (index != -1) ? entries_[index].get() : NULL; 260 return (index != -1) ? entries_[index].get() : NULL;
258 } 261 }
259 262
260 void NavigationController::LoadEntry(NavigationEntry* entry) { 263 void NavigationController::LoadEntry(NavigationEntry* entry) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 DiscardTransientEntry(); 497 DiscardTransientEntry();
495 entries_.insert(entries_.begin() + index, linked_ptr<NavigationEntry>(entry)); 498 entries_.insert(entries_.begin() + index, linked_ptr<NavigationEntry>(entry));
496 transient_entry_index_ = index; 499 transient_entry_index_ = index;
497 tab_contents_->NotifyNavigationStateChanged(kInvalidateAll); 500 tab_contents_->NotifyNavigationStateChanged(kInvalidateAll);
498 } 501 }
499 502
500 void NavigationController::LoadURL( 503 void NavigationController::LoadURL(
501 const GURL& url, 504 const GURL& url,
502 const GURL& referrer, 505 const GURL& referrer,
503 content::PageTransition transition, 506 content::PageTransition transition,
504 const std::string& extra_headers) { 507 const std::string& extra_headers,
508 int64 opener_browsing_instance_frame_id) {
505 // The user initiated a load, we don't need to reload anymore. 509 // The user initiated a load, we don't need to reload anymore.
510 DCHECK_EQ(opener_browsing_instance_frame_id, -1);
506 needs_reload_ = false; 511 needs_reload_ = false;
507 512
508 NavigationEntry* entry = CreateNavigationEntry(url, referrer, transition, 513 NavigationEntry* entry = CreateNavigationEntry(
509 false, 514 url, referrer, transition, false, extra_headers,
510 extra_headers, 515 browser_context_, opener_browsing_instance_frame_id);
511 browser_context_);
512 516
513 LoadEntry(entry); 517 LoadEntry(entry);
514 } 518 }
515 519
516 void NavigationController::LoadURLFromRenderer( 520 void NavigationController::LoadURLFromRenderer(
517 const GURL& url, 521 const GURL& url,
518 const GURL& referrer, 522 const GURL& referrer,
519 content::PageTransition transition, 523 content::PageTransition transition,
520 const std::string& extra_headers) { 524 const std::string& extra_headers,
525 int64 opener_browsing_instance_frame_id) {
521 // The user initiated a load, we don't need to reload anymore. 526 // The user initiated a load, we don't need to reload anymore.
522 needs_reload_ = false; 527 needs_reload_ = false;
523 528
524 NavigationEntry* entry = CreateNavigationEntry(url, referrer, transition, 529 NavigationEntry* entry = CreateNavigationEntry(
525 true, 530 url, referrer, transition, true, extra_headers,
526 extra_headers, 531 browser_context_, opener_browsing_instance_frame_id);
527 browser_context_);
528 532
529 LoadEntry(entry); 533 LoadEntry(entry);
530 } 534 }
531 535
532 void NavigationController::DocumentLoadedInFrame() { 536 void NavigationController::DocumentLoadedInFrame() {
533 last_document_loaded_ = base::TimeTicks::Now(); 537 last_document_loaded_ = base::TimeTicks::Now();
534 } 538 }
535 539
536 bool NavigationController::RendererDidNavigate( 540 bool NavigationController::RendererDidNavigate(
537 const ViewHostMsg_FrameNavigate_Params& params, 541 const ViewHostMsg_FrameNavigate_Params& params,
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 for (int i = 0; i < max_index; i++) { 1259 for (int i = 0; i < max_index; i++) {
1256 // When cloning a tab, copy all entries except interstitial pages 1260 // When cloning a tab, copy all entries except interstitial pages
1257 if (source.entries_[i].get()->page_type() != 1261 if (source.entries_[i].get()->page_type() !=
1258 content::PAGE_TYPE_INTERSTITIAL) { 1262 content::PAGE_TYPE_INTERSTITIAL) {
1259 entries_.insert(entries_.begin() + insert_index++, 1263 entries_.insert(entries_.begin() + insert_index++,
1260 linked_ptr<NavigationEntry>( 1264 linked_ptr<NavigationEntry>(
1261 new NavigationEntry(*source.entries_[i]))); 1265 new NavigationEntry(*source.entries_[i])));
1262 } 1266 }
1263 } 1267 }
1264 } 1268 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698