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

Side by Side Diff: chrome/browser/managed_mode/managed_mode_navigation_observer.cc

Issue 12334073: Remove WebContents methods that duplicate WebContentsView methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
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/managed_mode/managed_mode_navigation_observer.h" 5 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/ui/browser_list.h" 25 #include "chrome/browser/ui/browser_list.h"
26 #include "chrome/browser/ui/host_desktop.h" 26 #include "chrome/browser/ui/host_desktop.h"
27 #include "chrome/browser/ui/tabs/tab_strip_model.h" 27 #include "chrome/browser/ui/tabs/tab_strip_model.h"
28 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
30 #include "content/public/browser/browser_thread.h" 30 #include "content/public/browser/browser_thread.h"
31 #include "content/public/browser/render_process_host.h" 31 #include "content/public/browser/render_process_host.h"
32 #include "content/public/browser/render_view_host.h" 32 #include "content/public/browser/render_view_host.h"
33 #include "content/public/browser/user_metrics.h" 33 #include "content/public/browser/user_metrics.h"
34 #include "content/public/browser/web_contents_delegate.h" 34 #include "content/public/browser/web_contents_delegate.h"
35 #include "content/public/browser/web_contents_view.h"
35 #include "content/public/common/frame_navigate_params.h" 36 #include "content/public/common/frame_navigate_params.h"
36 #include "grit/generated_resources.h" 37 #include "grit/generated_resources.h"
37 #include "grit/locale_settings.h" 38 #include "grit/locale_settings.h"
38 #include "ui/base/l10n/l10n_util.h" 39 #include "ui/base/l10n/l10n_util.h"
39 40
40 using content::BrowserThread; 41 using content::BrowserThread;
41 using content::UserMetricsAction; 42 using content::UserMetricsAction;
42 43
43 namespace { 44 namespace {
44 45
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 content::NavigationController* controller = 85 content::NavigationController* controller =
85 &web_contents->GetController(); 86 &web_contents->GetController();
86 if (controller->CanGoBack()) { 87 if (controller->CanGoBack()) {
87 controller->GoBack(); 88 controller->GoBack();
88 return; 89 return;
89 } 90 }
90 91
91 // If we can't go back (because we opened a new tab), try to close the tab. 92 // If we can't go back (because we opened a new tab), try to close the tab.
92 // If this is the last tab on this desktop, open a new window. 93 // If this is the last tab on this desktop, open a new window.
93 chrome::HostDesktopType host_desktop_type = 94 chrome::HostDesktopType host_desktop_type =
94 chrome::GetHostDesktopTypeForNativeView(web_contents->GetNativeView()); 95 chrome::GetHostDesktopTypeForNativeView(
96 web_contents->GetView()->GetNativeView());
95 const BrowserList* browser_list = BrowserList::GetInstance(host_desktop_type); 97 const BrowserList* browser_list = BrowserList::GetInstance(host_desktop_type);
96 if (browser_list->size() == 1) { 98 if (browser_list->size() == 1) {
97 Browser* browser = browser_list->get(0); 99 Browser* browser = browser_list->get(0);
98 DCHECK(browser == chrome::FindBrowserWithWebContents(web_contents)); 100 DCHECK(browser == chrome::FindBrowserWithWebContents(web_contents));
99 if (browser->tab_strip_model()->count() == 1) 101 if (browser->tab_strip_model()->count() == 1)
100 chrome::NewEmptyWindow(browser->profile(), browser->host_desktop_type()); 102 chrome::NewEmptyWindow(browser->profile(), browser->host_desktop_type());
101 } 103 }
102 104
103 web_contents->GetDelegate()->CloseContents(web_contents); 105 web_contents->GetDelegate()->CloseContents(web_contents);
104 } 106 }
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 if (behavior == ManagedModeURLFilter::ALLOW) 500 if (behavior == ManagedModeURLFilter::ALLOW)
499 last_allowed_page_ = web_contents()->GetController().GetCurrentEntryIndex(); 501 last_allowed_page_ = web_contents()->GetController().GetCurrentEntryIndex();
500 } 502 }
501 503
502 void ManagedModeNavigationObserver::DidGetUserGesture() { 504 void ManagedModeNavigationObserver::DidGetUserGesture() {
503 got_user_gesture_ = true; 505 got_user_gesture_ = true;
504 // Update the exception status so that the resource throttle knows that 506 // Update the exception status so that the resource throttle knows that
505 // there was a manual navigation. 507 // there was a manual navigation.
506 UpdateExceptionNavigationStatus(); 508 UpdateExceptionNavigationStatus();
507 } 509 }
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | chrome/browser/printing/print_preview_dialog_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698