OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 121 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
122 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 122 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
123 #include "chrome/browser/ui/global_error/global_error.h" | 123 #include "chrome/browser/ui/global_error/global_error.h" |
124 #include "chrome/browser/ui/global_error/global_error_service.h" | 124 #include "chrome/browser/ui/global_error/global_error_service.h" |
125 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 125 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
126 #include "chrome/browser/ui/location_bar/location_bar.h" | 126 #include "chrome/browser/ui/location_bar/location_bar.h" |
127 #include "chrome/browser/ui/media_utils.h" | 127 #include "chrome/browser/ui/media_utils.h" |
128 #include "chrome/browser/ui/search/search_delegate.h" | 128 #include "chrome/browser/ui/search/search_delegate.h" |
129 #include "chrome/browser/ui/search/search_model.h" | 129 #include "chrome/browser/ui/search/search_model.h" |
130 #include "chrome/browser/ui/search/search_tab_helper.h" | 130 #include "chrome/browser/ui/search/search_tab_helper.h" |
131 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | |
132 #include "chrome/browser/ui/settings_window_manager.h" | 131 #include "chrome/browser/ui/settings_window_manager.h" |
133 #include "chrome/browser/ui/singleton_tabs.h" | 132 #include "chrome/browser/ui/singleton_tabs.h" |
134 #include "chrome/browser/ui/status_bubble.h" | 133 #include "chrome/browser/ui/status_bubble.h" |
135 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" | 134 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" |
136 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 135 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
137 #include "chrome/browser/ui/tab_dialogs.h" | 136 #include "chrome/browser/ui/tab_dialogs.h" |
138 #include "chrome/browser/ui/tab_helpers.h" | 137 #include "chrome/browser/ui/tab_helpers.h" |
139 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 138 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
140 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 139 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
141 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 140 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1983 | 1982 |
1984 bool Browser::CanReloadContents(content::WebContents* web_contents) const { | 1983 bool Browser::CanReloadContents(content::WebContents* web_contents) const { |
1985 return chrome::CanReload(this); | 1984 return chrome::CanReload(this); |
1986 } | 1985 } |
1987 | 1986 |
1988 bool Browser::CanSaveContents(content::WebContents* web_contents) const { | 1987 bool Browser::CanSaveContents(content::WebContents* web_contents) const { |
1989 return chrome::CanSavePage(this); | 1988 return chrome::CanSavePage(this); |
1990 } | 1989 } |
1991 | 1990 |
1992 /////////////////////////////////////////////////////////////////////////////// | 1991 /////////////////////////////////////////////////////////////////////////////// |
1993 // Browser, SearchEngineTabHelperDelegate implementation: | |
1994 | |
1995 void Browser::ConfirmAddSearchProvider(TemplateURL* template_url, | |
1996 Profile* profile) { | |
1997 window()->ConfirmAddSearchProvider(template_url, profile); | |
1998 } | |
1999 | |
2000 /////////////////////////////////////////////////////////////////////////////// | |
2001 // Browser, SearchTabHelperDelegate implementation: | 1992 // Browser, SearchTabHelperDelegate implementation: |
2002 | 1993 |
2003 void Browser::NavigateOnThumbnailClick(const GURL& url, | 1994 void Browser::NavigateOnThumbnailClick(const GURL& url, |
2004 WindowOpenDisposition disposition, | 1995 WindowOpenDisposition disposition, |
2005 content::WebContents* source_contents) { | 1996 content::WebContents* source_contents) { |
2006 DCHECK(source_contents); | 1997 DCHECK(source_contents); |
2007 // We're guaranteed that AUTO_BOOKMARK is the right transition since this only | 1998 // We're guaranteed that AUTO_BOOKMARK is the right transition since this only |
2008 // gets called to handle clicks in the new tab page (to navigate to most | 1999 // gets called to handle clicks in the new tab page (to navigate to most |
2009 // visited item URLs) and in the search results page (to navigate to | 2000 // visited item URLs) and in the search results page (to navigate to |
2010 // privileged destinations (e.g. chrome://URLs)). | 2001 // privileged destinations (e.g. chrome://URLs)). |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2470 void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) { | 2461 void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) { |
2471 Browser* delegate = set_delegate ? this : NULL; | 2462 Browser* delegate = set_delegate ? this : NULL; |
2472 // WebContents... | 2463 // WebContents... |
2473 web_contents->SetDelegate(delegate); | 2464 web_contents->SetDelegate(delegate); |
2474 | 2465 |
2475 // ...and all the helpers. | 2466 // ...and all the helpers. |
2476 BookmarkTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2467 BookmarkTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
2477 WebContentsModalDialogManager::FromWebContents(web_contents)-> | 2468 WebContentsModalDialogManager::FromWebContents(web_contents)-> |
2478 SetDelegate(delegate); | 2469 SetDelegate(delegate); |
2479 CoreTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2470 CoreTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
2480 SearchEngineTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | |
2481 SearchTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2471 SearchTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
2482 translate::ContentTranslateDriver& content_translate_driver = | 2472 translate::ContentTranslateDriver& content_translate_driver = |
2483 ChromeTranslateClient::FromWebContents(web_contents)->translate_driver(); | 2473 ChromeTranslateClient::FromWebContents(web_contents)->translate_driver(); |
2484 if (delegate) { | 2474 if (delegate) { |
2485 ui_zoom::ZoomController::FromWebContents(web_contents)->AddObserver(this); | 2475 ui_zoom::ZoomController::FromWebContents(web_contents)->AddObserver(this); |
2486 content_translate_driver.AddObserver(this); | 2476 content_translate_driver.AddObserver(this); |
2487 } else { | 2477 } else { |
2488 ui_zoom::ZoomController::FromWebContents(web_contents)->RemoveObserver( | 2478 ui_zoom::ZoomController::FromWebContents(web_contents)->RemoveObserver( |
2489 this); | 2479 this); |
2490 content_translate_driver.RemoveObserver(this); | 2480 content_translate_driver.RemoveObserver(this); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 if (contents && !allow_js_access) { | 2723 if (contents && !allow_js_access) { |
2734 contents->web_contents()->GetController().LoadURL( | 2724 contents->web_contents()->GetController().LoadURL( |
2735 target_url, | 2725 target_url, |
2736 content::Referrer(), | 2726 content::Referrer(), |
2737 ui::PAGE_TRANSITION_LINK, | 2727 ui::PAGE_TRANSITION_LINK, |
2738 std::string()); // No extra headers. | 2728 std::string()); // No extra headers. |
2739 } | 2729 } |
2740 | 2730 |
2741 return contents != NULL; | 2731 return contents != NULL; |
2742 } | 2732 } |
OLD | NEW |