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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 120 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
121 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 121 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
122 #include "chrome/browser/ui/global_error/global_error.h" | 122 #include "chrome/browser/ui/global_error/global_error.h" |
123 #include "chrome/browser/ui/global_error/global_error_service.h" | 123 #include "chrome/browser/ui/global_error/global_error_service.h" |
124 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 124 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
125 #include "chrome/browser/ui/location_bar/location_bar.h" | 125 #include "chrome/browser/ui/location_bar/location_bar.h" |
126 #include "chrome/browser/ui/media_utils.h" | 126 #include "chrome/browser/ui/media_utils.h" |
127 #include "chrome/browser/ui/search/search_delegate.h" | 127 #include "chrome/browser/ui/search/search_delegate.h" |
128 #include "chrome/browser/ui/search/search_model.h" | 128 #include "chrome/browser/ui/search/search_model.h" |
129 #include "chrome/browser/ui/search/search_tab_helper.h" | 129 #include "chrome/browser/ui/search/search_tab_helper.h" |
130 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | |
131 #include "chrome/browser/ui/settings_window_manager.h" | 130 #include "chrome/browser/ui/settings_window_manager.h" |
132 #include "chrome/browser/ui/singleton_tabs.h" | 131 #include "chrome/browser/ui/singleton_tabs.h" |
133 #include "chrome/browser/ui/status_bubble.h" | 132 #include "chrome/browser/ui/status_bubble.h" |
134 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" | 133 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" |
135 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 134 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
136 #include "chrome/browser/ui/tab_dialogs.h" | 135 #include "chrome/browser/ui/tab_dialogs.h" |
137 #include "chrome/browser/ui/tab_helpers.h" | 136 #include "chrome/browser/ui/tab_helpers.h" |
138 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 137 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
139 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 138 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
140 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 139 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1996 | 1995 |
1997 bool Browser::CanReloadContents(content::WebContents* web_contents) const { | 1996 bool Browser::CanReloadContents(content::WebContents* web_contents) const { |
1998 return chrome::CanReload(this); | 1997 return chrome::CanReload(this); |
1999 } | 1998 } |
2000 | 1999 |
2001 bool Browser::CanSaveContents(content::WebContents* web_contents) const { | 2000 bool Browser::CanSaveContents(content::WebContents* web_contents) const { |
2002 return chrome::CanSavePage(this); | 2001 return chrome::CanSavePage(this); |
2003 } | 2002 } |
2004 | 2003 |
2005 /////////////////////////////////////////////////////////////////////////////// | 2004 /////////////////////////////////////////////////////////////////////////////// |
2006 // Browser, SearchEngineTabHelperDelegate implementation: | |
2007 | |
2008 void Browser::ConfirmAddSearchProvider(TemplateURL* template_url, | |
2009 Profile* profile) { | |
2010 window()->ConfirmAddSearchProvider(template_url, profile); | |
2011 } | |
2012 | |
2013 /////////////////////////////////////////////////////////////////////////////// | |
2014 // Browser, SearchTabHelperDelegate implementation: | 2005 // Browser, SearchTabHelperDelegate implementation: |
2015 | 2006 |
2016 void Browser::NavigateOnThumbnailClick(const GURL& url, | 2007 void Browser::NavigateOnThumbnailClick(const GURL& url, |
2017 WindowOpenDisposition disposition, | 2008 WindowOpenDisposition disposition, |
2018 content::WebContents* source_contents) { | 2009 content::WebContents* source_contents) { |
2019 DCHECK(source_contents); | 2010 DCHECK(source_contents); |
2020 // We're guaranteed that AUTO_BOOKMARK is the right transition since this only | 2011 // We're guaranteed that AUTO_BOOKMARK is the right transition since this only |
2021 // gets called to handle clicks in the new tab page (to navigate to most | 2012 // gets called to handle clicks in the new tab page (to navigate to most |
2022 // visited item URLs) and in the search results page (to navigate to | 2013 // visited item URLs) and in the search results page (to navigate to |
2023 // privileged destinations (e.g. chrome://URLs)). | 2014 // privileged destinations (e.g. chrome://URLs)). |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2483 void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) { | 2474 void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) { |
2484 Browser* delegate = set_delegate ? this : NULL; | 2475 Browser* delegate = set_delegate ? this : NULL; |
2485 // WebContents... | 2476 // WebContents... |
2486 web_contents->SetDelegate(delegate); | 2477 web_contents->SetDelegate(delegate); |
2487 | 2478 |
2488 // ...and all the helpers. | 2479 // ...and all the helpers. |
2489 BookmarkTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2480 BookmarkTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
2490 WebContentsModalDialogManager::FromWebContents(web_contents)-> | 2481 WebContentsModalDialogManager::FromWebContents(web_contents)-> |
2491 SetDelegate(delegate); | 2482 SetDelegate(delegate); |
2492 CoreTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2483 CoreTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
2493 SearchEngineTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | |
2494 SearchTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2484 SearchTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
2495 translate::ContentTranslateDriver& content_translate_driver = | 2485 translate::ContentTranslateDriver& content_translate_driver = |
2496 ChromeTranslateClient::FromWebContents(web_contents)->translate_driver(); | 2486 ChromeTranslateClient::FromWebContents(web_contents)->translate_driver(); |
2497 if (delegate) { | 2487 if (delegate) { |
2498 ui_zoom::ZoomController::FromWebContents(web_contents)->AddObserver(this); | 2488 ui_zoom::ZoomController::FromWebContents(web_contents)->AddObserver(this); |
2499 content_translate_driver.AddObserver(this); | 2489 content_translate_driver.AddObserver(this); |
2500 } else { | 2490 } else { |
2501 ui_zoom::ZoomController::FromWebContents(web_contents)->RemoveObserver( | 2491 ui_zoom::ZoomController::FromWebContents(web_contents)->RemoveObserver( |
2502 this); | 2492 this); |
2503 content_translate_driver.RemoveObserver(this); | 2493 content_translate_driver.RemoveObserver(this); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2746 if (contents && !allow_js_access) { | 2736 if (contents && !allow_js_access) { |
2747 contents->web_contents()->GetController().LoadURL( | 2737 contents->web_contents()->GetController().LoadURL( |
2748 target_url, | 2738 target_url, |
2749 content::Referrer(), | 2739 content::Referrer(), |
2750 ui::PAGE_TRANSITION_LINK, | 2740 ui::PAGE_TRANSITION_LINK, |
2751 std::string()); // No extra headers. | 2741 std::string()); // No extra headers. |
2752 } | 2742 } |
2753 | 2743 |
2754 return contents != NULL; | 2744 return contents != NULL; |
2755 } | 2745 } |
OLD | NEW |