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

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

Issue 3436002: Add the onBeforeNavigate and onErrorOccured events to the webNavigation API. (Closed)
Patch Set: updates Created 10 years, 3 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/tab_contents/tab_contents.h" 5 #include "chrome/browser/tab_contents/tab_contents.h"
6 6
7 #if defined(OS_CHROMEOS) 7 #if defined(OS_CHROMEOS)
8 // For GdkScreen 8 // For GdkScreen
9 #include <gdk/gdk.h> 9 #include <gdk/gdk.h>
10 #endif // defined(OS_CHROMEOS) 10 #endif // defined(OS_CHROMEOS)
(...skipping 2434 matching lines...) Expand 10 before | Expand all | Expand 10 after
2445 // (see http://code.google.com/p/chromium/issues/detail?id=2929 ) 2445 // (see http://code.google.com/p/chromium/issues/detail?id=2929 )
2446 // TODO(jungshik): Add a test for the encoding menu to avoid 2446 // TODO(jungshik): Add a test for the encoding menu to avoid
2447 // regressing it again. 2447 // regressing it again.
2448 if (PageTransition::IsMainFrame(params.transition)) 2448 if (PageTransition::IsMainFrame(params.transition))
2449 contents_mime_type_ = params.contents_mime_type; 2449 contents_mime_type_ = params.contents_mime_type;
2450 2450
2451 NavigationController::LoadCommittedDetails details; 2451 NavigationController::LoadCommittedDetails details;
2452 bool did_navigate = controller_.RendererDidNavigate( 2452 bool did_navigate = controller_.RendererDidNavigate(
2453 params, extra_invalidate_flags, &details); 2453 params, extra_invalidate_flags, &details);
2454 2454
2455 // Send notification about committed provisional loads. This notification is
2456 // different from the NAV_ENTRY_COMMITTED notification which doesn't include
2457 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations.
2458 if (details.type != NavigationType::NAV_IGNORE) {
2459 ProvisionalLoadDetails load_details(details.is_main_frame,
2460 details.is_in_page,
2461 params.url, std::string(), false);
2462 load_details.set_transition_type(params.transition);
2463 // Whether or not a page transition was triggered by going backward or
2464 // forward in the history is only stored in the navigation controller's
2465 // entry list.
2466 if (did_navigate &&
2467 (controller_.GetActiveEntry()->transition_type() &
2468 PageTransition::FORWARD_BACK)) {
2469 load_details.set_transition_type(
2470 params.transition | PageTransition::FORWARD_BACK);
2471 }
2472 NotificationService::current()->Notify(
2473 NotificationType::FRAME_PROVISIONAL_LOAD_COMMITTED,
2474 Source<NavigationController>(&controller_),
2475 Details<ProvisionalLoadDetails>(&load_details));
2476
2477 }
2478
2455 // Update history. Note that this needs to happen after the entry is complete, 2479 // Update history. Note that this needs to happen after the entry is complete,
2456 // which WillNavigate[Main,Sub]Frame will do before this function is called. 2480 // which WillNavigate[Main,Sub]Frame will do before this function is called.
2457 if (params.should_update_history) { 2481 if (params.should_update_history) {
2458 // Most of the time, the displayURL matches the loaded URL, but for about: 2482 // Most of the time, the displayURL matches the loaded URL, but for about:
2459 // URLs, we use a data: URL as the real value. We actually want to save the 2483 // URLs, we use a data: URL as the real value. We actually want to save the
2460 // about: URL to the history db and keep the data: URL hidden. This is what 2484 // about: URL to the history db and keep the data: URL hidden. This is what
2461 // the TabContents' URL getter does. 2485 // the TabContents' URL getter does.
2462 scoped_refptr<history::HistoryAddPageArgs> add_page_args( 2486 scoped_refptr<history::HistoryAddPageArgs> add_page_args(
2463 CreateHistoryAddPageArgs(GetURL(), details, params)); 2487 CreateHistoryAddPageArgs(GetURL(), details, params));
2464 if (!delegate() || 2488 if (!delegate() ||
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
3271 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); 3295 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save));
3272 } 3296 }
3273 3297
3274 Profile* TabContents::GetProfileForPasswordManager() { 3298 Profile* TabContents::GetProfileForPasswordManager() {
3275 return profile(); 3299 return profile();
3276 } 3300 }
3277 3301
3278 bool TabContents::DidLastPageLoadEncounterSSLErrors() { 3302 bool TabContents::DidLastPageLoadEncounterSSLErrors() {
3279 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); 3303 return controller().ssl_manager()->ProcessedSSLErrorFromRequest();
3280 } 3304 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/provisional_load_details.cc ('k') | chrome/common/notification_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698