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_commands.h" | 5 #include "chrome/browser/ui/browser_commands.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 #include "chrome/common/content_restriction.h" | 61 #include "chrome/common/content_restriction.h" |
62 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 62 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
63 #include "chrome/common/pref_names.h" | 63 #include "chrome/common/pref_names.h" |
64 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 64 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
65 #include "content/public/browser/devtools_agent_host.h" | 65 #include "content/public/browser/devtools_agent_host.h" |
66 #include "content/public/browser/navigation_controller.h" | 66 #include "content/public/browser/navigation_controller.h" |
67 #include "content/public/browser/navigation_entry.h" | 67 #include "content/public/browser/navigation_entry.h" |
68 #include "content/public/browser/notification_service.h" | 68 #include "content/public/browser/notification_service.h" |
69 #include "content/public/browser/page_navigator.h" | 69 #include "content/public/browser/page_navigator.h" |
70 #include "content/public/browser/render_view_host.h" | 70 #include "content/public/browser/render_view_host.h" |
71 #include "content/public/browser/render_widget_host_view.h" | |
71 #include "content/public/browser/user_metrics.h" | 72 #include "content/public/browser/user_metrics.h" |
72 #include "content/public/browser/web_contents.h" | 73 #include "content/public/browser/web_contents.h" |
73 #include "content/public/browser/web_contents_view.h" | 74 #include "content/public/browser/web_contents_view.h" |
74 #include "content/public/common/renderer_preferences.h" | 75 #include "content/public/common/renderer_preferences.h" |
75 #include "content/public/common/url_constants.h" | 76 #include "content/public/common/url_constants.h" |
76 #include "content/public/common/url_utils.h" | 77 #include "content/public/common/url_utils.h" |
77 #include "net/base/escape.h" | 78 #include "net/base/escape.h" |
78 #include "webkit/common/user_agent/user_agent_util.h" | 79 #include "webkit/common/user_agent/user_agent_util.h" |
79 | 80 |
80 #if defined(OS_WIN) | 81 #if defined(OS_WIN) |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
884 // Incognito window it's the newest value of the find pboard content and | 885 // Incognito window it's the newest value of the find pboard content and |
885 // user-typed text. | 886 // user-typed text. |
886 FindBar* find_bar = browser->GetFindBarController()->find_bar(); | 887 FindBar* find_bar = browser->GetFindBarController()->find_bar(); |
887 find_text = find_bar->GetFindText(); | 888 find_text = find_bar->GetFindText(); |
888 #endif | 889 #endif |
889 find_helper->StartFinding(find_text, forward_direction, false); | 890 find_helper->StartFinding(find_text, forward_direction, false); |
890 } | 891 } |
891 } | 892 } |
892 | 893 |
893 void Zoom(Browser* browser, content::PageZoom zoom) { | 894 void Zoom(Browser* browser, content::PageZoom zoom) { |
894 if (browser->is_devtools()) | 895 DevToolsWindow* devtools = DevToolsWindow::GetDockedInstanceForInspectedTab( |
896 browser->tab_strip_model()->GetActiveWebContents()); | |
vsevik
2014/02/12 15:13:43
nit: You could extract browser->tab_strip_model()-
dgozman
2014/02/12 16:27:16
Done.
| |
897 if (devtools && devtools->web_contents()->GetRenderWidgetHostView() && | |
898 devtools->web_contents()->GetRenderWidgetHostView()->HasFocus()) { | |
899 chrome_page_zoom::Zoom(devtools->web_contents(), zoom); | |
895 return; | 900 return; |
901 } | |
896 | 902 |
897 chrome_page_zoom::Zoom(browser->tab_strip_model()->GetActiveWebContents(), | 903 chrome_page_zoom::Zoom(browser->tab_strip_model()->GetActiveWebContents(), |
898 zoom); | 904 zoom); |
899 } | 905 } |
900 | 906 |
901 void FocusToolbar(Browser* browser) { | 907 void FocusToolbar(Browser* browser) { |
902 content::RecordAction(UserMetricsAction("FocusToolbar")); | 908 content::RecordAction(UserMetricsAction("FocusToolbar")); |
903 browser->window()->FocusToolbar(); | 909 browser->window()->FocusToolbar(); |
904 } | 910 } |
905 | 911 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1183 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile(), | 1189 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile(), |
1184 browser->host_desktop_type())); | 1190 browser->host_desktop_type())); |
1185 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1191 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1186 | 1192 |
1187 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1193 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1188 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1194 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1189 app_browser->window()->Show(); | 1195 app_browser->window()->Show(); |
1190 } | 1196 } |
1191 | 1197 |
1192 } // namespace chrome | 1198 } // namespace chrome |
OLD | NEW |