OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 /* | 5 /* |
6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * | 10 * |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 pending_entry_index_(-1), | 219 pending_entry_index_(-1), |
220 transient_entry_index_(-1), | 220 transient_entry_index_(-1), |
221 delegate_(delegate), | 221 delegate_(delegate), |
222 max_restored_page_id_(-1), | 222 max_restored_page_id_(-1), |
223 ssl_manager_(this), | 223 ssl_manager_(this), |
224 needs_reload_(false), | 224 needs_reload_(false), |
225 is_initial_navigation_(true), | 225 is_initial_navigation_(true), |
226 in_navigate_to_pending_entry_(false), | 226 in_navigate_to_pending_entry_(false), |
227 pending_reload_(ReloadType::NONE), | 227 pending_reload_(ReloadType::NONE), |
228 get_timestamp_callback_(base::Bind(&base::Time::Now)), | 228 get_timestamp_callback_(base::Bind(&base::Time::Now)), |
229 screenshot_manager_(new NavigationEntryScreenshotManager(this)) { | 229 screenshot_manager_(new NavigationEntryScreenshotManager(this)), |
230 last_committed_reload_type_(ReloadType::NONE) { | |
230 DCHECK(browser_context_); | 231 DCHECK(browser_context_); |
231 } | 232 } |
232 | 233 |
233 NavigationControllerImpl::~NavigationControllerImpl() { | 234 NavigationControllerImpl::~NavigationControllerImpl() { |
234 DiscardNonCommittedEntriesInternal(); | 235 DiscardNonCommittedEntriesInternal(); |
235 } | 236 } |
236 | 237 |
237 WebContents* NavigationControllerImpl::GetWebContents() const { | 238 WebContents* NavigationControllerImpl::GetWebContents() const { |
238 return delegate_->GetWebContents(); | 239 return delegate_->GetWebContents(); |
239 } | 240 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 if (current_index != -1) { | 323 if (current_index != -1) { |
323 entry = GetEntryAtIndex(current_index); | 324 entry = GetEntryAtIndex(current_index); |
324 } | 325 } |
325 } | 326 } |
326 | 327 |
327 // If we are no where, then we can't reload. TODO(darin): We should add a | 328 // If we are no where, then we can't reload. TODO(darin): We should add a |
328 // CanReload method. | 329 // CanReload method. |
329 if (!entry) | 330 if (!entry) |
330 return; | 331 return; |
331 | 332 |
333 // Check if previous navigation was reload to track reload operations. | |
334 if (last_committed_reload_type_ != ReloadType::NONE) { | |
335 base::Time now = | |
336 time_smoother_.GetSmoothedTime(get_timestamp_callback_.Run()); | |
337 base::TimeDelta delta = now - last_committed_reload_time_; | |
338 UMA_HISTOGRAM_MEDIUM_TIMES("Navigation.Reload.ReloadToReloadDuration", | |
339 delta); | |
340 LOG(ERROR) << "Reload: " << delta; | |
Takashi Toyoshima
2016/09/12 10:42:00
LOG(ERROR) at line 340 and 344 are for debug. Will
| |
341 if (last_committed_reload_type_ == ReloadType::MAIN_RESOURCE) { | |
342 UMA_HISTOGRAM_MEDIUM_TIMES( | |
343 "Navigation.Reload.ReloadMainResourceToReloadDuration", delta); | |
344 LOG(ERROR) << "Reload m: " << delta; | |
345 } | |
346 } | |
347 | |
348 // Set ReloadType for |entry| in order to check it at commit time. | |
349 entry->set_reload_type(reload_type); | |
350 | |
332 if (g_check_for_repost && check_for_repost && | 351 if (g_check_for_repost && check_for_repost && |
333 entry->GetHasPostData()) { | 352 entry->GetHasPostData()) { |
334 // The user is asking to reload a page with POST data. Prompt to make sure | 353 // The user is asking to reload a page with POST data. Prompt to make sure |
335 // they really want to do this. If they do, the dialog will call us back | 354 // they really want to do this. If they do, the dialog will call us back |
336 // with check_for_repost = false. | 355 // with check_for_repost = false. |
337 delegate_->NotifyBeforeFormRepostWarningShow(); | 356 delegate_->NotifyBeforeFormRepostWarningShow(); |
338 | 357 |
339 pending_reload_ = reload_type; | 358 pending_reload_ = reload_type; |
340 delegate_->ActivateAndShowRepostFormWarningDialog(); | 359 delegate_->ActivateAndShowRepostFormWarningDialog(); |
341 } else { | 360 } else { |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
795 // The renderer tells us whether the navigation replaces the current entry. | 814 // The renderer tells us whether the navigation replaces the current entry. |
796 details->did_replace_entry = params.should_replace_current_entry; | 815 details->did_replace_entry = params.should_replace_current_entry; |
797 | 816 |
798 // Do navigation-type specific actions. These will make and commit an entry. | 817 // Do navigation-type specific actions. These will make and commit an entry. |
799 details->type = ClassifyNavigation(rfh, params); | 818 details->type = ClassifyNavigation(rfh, params); |
800 | 819 |
801 // is_in_page must be computed before the entry gets committed. | 820 // is_in_page must be computed before the entry gets committed. |
802 details->is_in_page = IsURLInPageNavigation(params.url, params.origin, | 821 details->is_in_page = IsURLInPageNavigation(params.url, params.origin, |
803 params.was_within_same_page, rfh); | 822 params.was_within_same_page, rfh); |
804 | 823 |
824 // FIXME: Remove debug code below. | |
Takashi Toyoshima
2016/09/12 10:42:00
Line 824-845 is also for debug.
Following code wo
| |
825 const char* navstr[] = { | |
826 "UNKNOWN ", | |
827 "NEW_PAGE ", | |
828 "EXISTING_PAGE", | |
829 "SAME_PAGE ", | |
830 "NEW_SUBFRAME ", | |
831 "AUTO_SUBFRAME", | |
832 "NAV_IGNORE " | |
833 }; | |
834 const char* gesstr[] = { | |
835 "GestureUser ", | |
836 "GestureAuto ", | |
837 "GestureUnknown" | |
838 }; | |
839 LOG(ERROR) << base::StringPrintf( | |
840 "@@@ %s, %d, [%s], [%s]\n", | |
841 pending_entry_ | |
842 ? base::StringPrintf("%d", pending_entry_->GetUniqueID()).c_str() | |
843 : "*", | |
844 params.nav_entry_id, navstr[details->type], gesstr[params.gesture]); | |
845 // FIXME: Remove debug code above. | |
846 if (pending_entry_ && pending_entry_->GetUniqueID() == params.nav_entry_id) { | |
847 last_committed_reload_type_ = pending_entry_->reload_type(); | |
848 last_committed_reload_time_ = pending_entry_->GetTimestamp(); | |
849 } else if ((details->type == NAVIGATION_TYPE_EXISTING_PAGE && | |
850 params.gesture == NavigationGestureUser) || | |
851 (details->type != NAVIGATION_TYPE_EXISTING_PAGE && | |
852 details->type != NAVIGATION_TYPE_AUTO_SUBFRAME)) { | |
853 last_committed_reload_type_ = ReloadType::NONE; | |
854 } | |
855 | |
805 switch (details->type) { | 856 switch (details->type) { |
806 case NAVIGATION_TYPE_NEW_PAGE: | 857 case NAVIGATION_TYPE_NEW_PAGE: |
807 RendererDidNavigateToNewPage(rfh, params, details->is_in_page, | 858 RendererDidNavigateToNewPage(rfh, params, details->is_in_page, |
808 details->did_replace_entry); | 859 details->did_replace_entry); |
809 break; | 860 break; |
810 case NAVIGATION_TYPE_EXISTING_PAGE: | 861 case NAVIGATION_TYPE_EXISTING_PAGE: |
811 details->did_replace_entry = details->is_in_page; | 862 details->did_replace_entry = details->is_in_page; |
812 RendererDidNavigateToExistingPage(rfh, params, details->is_in_page); | 863 RendererDidNavigateToExistingPage(rfh, params, details->is_in_page); |
813 break; | 864 break; |
814 case NAVIGATION_TYPE_SAME_PAGE: | 865 case NAVIGATION_TYPE_SAME_PAGE: |
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2101 } | 2152 } |
2102 } | 2153 } |
2103 } | 2154 } |
2104 | 2155 |
2105 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2156 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
2106 const base::Callback<base::Time()>& get_timestamp_callback) { | 2157 const base::Callback<base::Time()>& get_timestamp_callback) { |
2107 get_timestamp_callback_ = get_timestamp_callback; | 2158 get_timestamp_callback_ = get_timestamp_callback; |
2108 } | 2159 } |
2109 | 2160 |
2110 } // namespace content | 2161 } // namespace content |
OLD | NEW |