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

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

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Version for commit (merged again). 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 | 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 "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"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "content/browser/browser_context.h" 13 #include "content/browser/browser_context.h"
14 #include "content/browser/browser_url_handler.h" 14 #include "content/browser/browser_url_handler.h"
15 #include "content/browser/child_process_security_policy.h" 15 #include "content/browser/child_process_security_policy.h"
16 #include "content/browser/in_process_webkit/session_storage_namespace.h" 16 #include "content/browser/in_process_webkit/session_storage_namespace.h"
17 #include "content/browser/renderer_host/render_view_host.h" // Temporary 17 #include "content/browser/renderer_host/render_view_host.h" // Temporary
18 #include "content/browser/site_instance.h" 18 #include "content/browser/site_instance.h"
19 #include "content/browser/tab_contents/interstitial_page.h" 19 #include "content/browser/tab_contents/interstitial_page.h"
20 #include "content/browser/tab_contents/navigation_details.h" 20 #include "content/browser/tab_contents/navigation_details.h"
21 #include "content/browser/tab_contents/navigation_entry.h" 21 #include "content/browser/tab_contents/navigation_entry.h"
22 #include "content/browser/tab_contents/tab_contents.h" 22 #include "content/browser/tab_contents/tab_contents.h"
23 #include "content/browser/tab_contents/tab_contents_delegate.h" 23 #include "content/browser/tab_contents/tab_contents_delegate.h"
24 #include "content/browser/user_metrics.h" 24 #include "content/common/view_messages.h"
25 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
26 #include "content/public/browser/notification_types.h"
27 #include "content/public/browser/user_metrics.h"
26 #include "content/public/common/content_constants.h" 28 #include "content/public/common/content_constants.h"
27 #include "content/common/view_messages.h"
28 #include "content/public/browser/notification_types.h"
29 #include "net/base/escape.h" 29 #include "net/base/escape.h"
30 #include "net/base/mime_util.h" 30 #include "net/base/mime_util.h"
31 #include "net/base/net_util.h" 31 #include "net/base/net_util.h"
32 #include "webkit/glue/webkit_glue.h" 32 #include "webkit/glue/webkit_glue.h"
33 33
34 using content::UserMetricsAction;
35
34 namespace { 36 namespace {
35 37
36 const int kInvalidateAll = 0xFFFFFFFF; 38 const int kInvalidateAll = 0xFFFFFFFF;
37 39
38 // Invoked when entries have been pruned, or removed. For example, if the 40 // Invoked when entries have been pruned, or removed. For example, if the
39 // current entries are [google, digg, yahoo], with the current entry google, 41 // current entries are [google, digg, yahoo], with the current entry google,
40 // and the user types in cnet, then digg and yahoo are pruned. 42 // and the user types in cnet, then digg and yahoo are pruned.
41 void NotifyPrunedEntries(NavigationController* nav_controller, 43 void NotifyPrunedEntries(NavigationController* nav_controller,
42 bool from_front, 44 bool from_front,
43 int count) { 45 int count) {
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 params.page_id); 690 params.page_id);
689 if (existing_entry_index == -1) { 691 if (existing_entry_index == -1) {
690 // The page was not found. It could have been pruned because of the limit on 692 // The page was not found. It could have been pruned because of the limit on
691 // back/forward entries (not likely since we'll usually tell it to navigate 693 // back/forward entries (not likely since we'll usually tell it to navigate
692 // to such entries). It could also mean that the renderer is smoking crack. 694 // to such entries). It could also mean that the renderer is smoking crack.
693 NOTREACHED(); 695 NOTREACHED();
694 696
695 // Because the unknown entry has committed, we risk showing the wrong URL in 697 // Because the unknown entry has committed, we risk showing the wrong URL in
696 // release builds. Instead, we'll kill the renderer process to be safe. 698 // release builds. Instead, we'll kill the renderer process to be safe.
697 LOG(ERROR) << "terminating renderer for bad navigation: " << params.url; 699 LOG(ERROR) << "terminating renderer for bad navigation: " << params.url;
698 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_NC")); 700 content::RecordAction(UserMetricsAction("BadMessageTerminate_NC"));
699 701
700 // Temporary code so we can get more information. Format: 702 // Temporary code so we can get more information. Format:
701 // http://url/foo.html#page1#max3#frame1#ids:2_Nx,1_1x,3_2 703 // http://url/foo.html#page1#max3#frame1#ids:2_Nx,1_1x,3_2
702 std::string temp = params.url.spec(); 704 std::string temp = params.url.spec();
703 temp.append("#page"); 705 temp.append("#page");
704 temp.append(base::IntToString(params.page_id)); 706 temp.append(base::IntToString(params.page_id));
705 temp.append("#max"); 707 temp.append("#max");
706 temp.append(base::IntToString(tab_contents_->GetMaxPageID())); 708 temp.append(base::IntToString(tab_contents_->GetMaxPageID()));
707 temp.append("#frame"); 709 temp.append("#frame");
708 temp.append(base::IntToString(params.frame_id)); 710 temp.append(base::IntToString(params.frame_id));
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 for (int i = 0; i < max_index; i++) { 1294 for (int i = 0; i < max_index; i++) {
1293 // When cloning a tab, copy all entries except interstitial pages 1295 // When cloning a tab, copy all entries except interstitial pages
1294 if (source.entries_[i].get()->page_type() != 1296 if (source.entries_[i].get()->page_type() !=
1295 content::PAGE_TYPE_INTERSTITIAL) { 1297 content::PAGE_TYPE_INTERSTITIAL) {
1296 entries_.insert(entries_.begin() + insert_index++, 1298 entries_.insert(entries_.begin() + insert_index++,
1297 linked_ptr<NavigationEntry>( 1299 linked_ptr<NavigationEntry>(
1298 new NavigationEntry(*source.entries_[i]))); 1300 new NavigationEntry(*source.entries_[i])));
1299 } 1301 }
1300 } 1302 }
1301 } 1303 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host.cc ('k') | content/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698