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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 301733006: Zoom Extension API (chrome) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add event manager for manual zoom events. Created 6 years, 6 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 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 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 43 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
44 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h" 44 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h"
45 #include "chrome/browser/custom_handlers/register_protocol_handler_permission_re quest.h" 45 #include "chrome/browser/custom_handlers/register_protocol_handler_permission_re quest.h"
46 #include "chrome/browser/defaults.h" 46 #include "chrome/browser/defaults.h"
47 #include "chrome/browser/devtools/devtools_toggle_action.h" 47 #include "chrome/browser/devtools/devtools_toggle_action.h"
48 #include "chrome/browser/devtools/devtools_window.h" 48 #include "chrome/browser/devtools/devtools_window.h"
49 #include "chrome/browser/download/download_item_model.h" 49 #include "chrome/browser/download/download_item_model.h"
50 #include "chrome/browser/download/download_service.h" 50 #include "chrome/browser/download/download_service.h"
51 #include "chrome/browser/download/download_service_factory.h" 51 #include "chrome/browser/download/download_service_factory.h"
52 #include "chrome/browser/download/download_shelf.h" 52 #include "chrome/browser/download/download_shelf.h"
53 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h"
54 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h"
53 #include "chrome/browser/extensions/browser_extension_window_controller.h" 55 #include "chrome/browser/extensions/browser_extension_window_controller.h"
54 #include "chrome/browser/extensions/extension_service.h" 56 #include "chrome/browser/extensions/extension_service.h"
55 #include "chrome/browser/extensions/tab_helper.h" 57 #include "chrome/browser/extensions/tab_helper.h"
56 #include "chrome/browser/favicon/favicon_tab_helper.h" 58 #include "chrome/browser/favicon/favicon_tab_helper.h"
57 #include "chrome/browser/file_select_helper.h" 59 #include "chrome/browser/file_select_helper.h"
58 #include "chrome/browser/first_run/first_run.h" 60 #include "chrome/browser/first_run/first_run.h"
59 #include "chrome/browser/history/top_sites.h" 61 #include "chrome/browser/history/top_sites.h"
60 #include "chrome/browser/infobars/infobar_service.h" 62 #include "chrome/browser/infobars/infobar_service.h"
61 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" 63 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h"
62 #include "chrome/browser/lifetime/application_lifetime.h" 64 #include "chrome/browser/lifetime/application_lifetime.h"
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 1844
1843 void Browser::OnZoomChanged(content::WebContents* source, 1845 void Browser::OnZoomChanged(content::WebContents* source,
1844 bool can_show_bubble) { 1846 bool can_show_bubble) {
1845 if (source == tab_strip_model_->GetActiveWebContents()) { 1847 if (source == tab_strip_model_->GetActiveWebContents()) {
1846 // Only show the zoom bubble for zoom changes in the active window. 1848 // Only show the zoom bubble for zoom changes in the active window.
1847 window_->ZoomChangedForActiveTab(can_show_bubble && window_->IsActive() && 1849 window_->ZoomChangedForActiveTab(can_show_bubble && window_->IsActive() &&
1848 !is_devtools()); 1850 !is_devtools());
1849 } 1851 }
1850 } 1852 }
1851 1853
1854 void Browser::OnZoomChangeInitiated(content::WebContents* web_contents,
1855 double old_zoom_level,
1856 double new_zoom_level,
1857 ZoomMode zoom_mode) {
1858 // TODO(wjmaclean) Is there any way we could hook the TabsEventRouter up
Devlin 2014/06/16 19:04:49 Yes, this is bad. There might be a good way to at
wjmaclean 2014/06/18 19:03:54 Done. This is a bit messy, since Browser is handl
1859 // directly as a ZoomObserver?
1860 extensions::TabsWindowsAPI* tabs_windows_api =
1861 extensions::TabsWindowsAPI::Get(web_contents->GetBrowserContext());
1862 tabs_windows_api->tabs_event_router()->OnZoomChangeInitiated(
1863 web_contents, old_zoom_level, new_zoom_level, zoom_mode);
1864 }
1865
1852 /////////////////////////////////////////////////////////////////////////////// 1866 ///////////////////////////////////////////////////////////////////////////////
1853 // Browser, ui::SelectFileDialog::Listener implementation: 1867 // Browser, ui::SelectFileDialog::Listener implementation:
1854 1868
1855 void Browser::FileSelected(const base::FilePath& path, int index, 1869 void Browser::FileSelected(const base::FilePath& path, int index,
1856 void* params) { 1870 void* params) {
1857 FileSelectedWithExtraInfo(ui::SelectedFileInfo(path, path), index, params); 1871 FileSelectedWithExtraInfo(ui::SelectedFileInfo(path, path), index, params);
1858 } 1872 }
1859 1873
1860 void Browser::FileSelectedWithExtraInfo(const ui::SelectedFileInfo& file_info, 1874 void Browser::FileSelectedWithExtraInfo(const ui::SelectedFileInfo& file_info,
1861 int index, 1875 int index,
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 if (contents && !allow_js_access) { 2431 if (contents && !allow_js_access) {
2418 contents->web_contents()->GetController().LoadURL( 2432 contents->web_contents()->GetController().LoadURL(
2419 target_url, 2433 target_url,
2420 content::Referrer(), 2434 content::Referrer(),
2421 content::PAGE_TRANSITION_LINK, 2435 content::PAGE_TRANSITION_LINK,
2422 std::string()); // No extra headers. 2436 std::string()); // No extra headers.
2423 } 2437 }
2424 2438
2425 return contents != NULL; 2439 return contents != NULL;
2426 } 2440 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698