Commit ce22687f authored by dgozman@chromium.org's avatar dgozman@chromium.org

[DevTools] Issue zoom from DevToolsWindow instead of browser commands.

This helps to avoid confusion when wrench menu zoom affects DevTools instead
of the page.

BUG=343816

Review URL: https://codereview.chromium.org/165213006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251448 0039d316-1c4b-4281-b951-d872f2087c98
parent 144ffe6a
...@@ -234,6 +234,15 @@ DevToolsEmbedderMessageDispatcher::DevToolsEmbedderMessageDispatcher( ...@@ -234,6 +234,15 @@ DevToolsEmbedderMessageDispatcher::DevToolsEmbedderMessageDispatcher(
RegisterHandler("searchInPath", RegisterHandler("searchInPath",
BindToListParser(base::Bind(&Delegate::SearchInPath, BindToListParser(base::Bind(&Delegate::SearchInPath,
base::Unretained(delegate)))); base::Unretained(delegate))));
RegisterHandler("zoomIn",
BindToListParser(base::Bind(&Delegate::ZoomIn,
base::Unretained(delegate))));
RegisterHandler("zoomOut",
BindToListParser(base::Bind(&Delegate::ZoomOut,
base::Unretained(delegate))));
RegisterHandler("resetZoom",
BindToListParser(base::Bind(&Delegate::ResetZoom,
base::Unretained(delegate))));
} }
DevToolsEmbedderMessageDispatcher::~DevToolsEmbedderMessageDispatcher() {} DevToolsEmbedderMessageDispatcher::~DevToolsEmbedderMessageDispatcher() {}
......
...@@ -54,6 +54,9 @@ class DevToolsEmbedderMessageDispatcher { ...@@ -54,6 +54,9 @@ class DevToolsEmbedderMessageDispatcher {
virtual void SearchInPath(int request_id, virtual void SearchInPath(int request_id,
const std::string& file_system_path, const std::string& file_system_path,
const std::string& query) = 0; const std::string& query) = 0;
virtual void ZoomIn() = 0;
virtual void ZoomOut() = 0;
virtual void ResetZoom() = 0;
}; };
explicit DevToolsEmbedderMessageDispatcher(Delegate* delegate); explicit DevToolsEmbedderMessageDispatcher(Delegate* delegate);
......
...@@ -1227,6 +1227,18 @@ void DevToolsWindow::SearchInPath(int request_id, ...@@ -1227,6 +1227,18 @@ void DevToolsWindow::SearchInPath(int request_id,
file_system_path)); file_system_path));
} }
void DevToolsWindow::ZoomIn() {
chrome_page_zoom::Zoom(web_contents(), content::PAGE_ZOOM_IN);
}
void DevToolsWindow::ZoomOut() {
chrome_page_zoom::Zoom(web_contents(), content::PAGE_ZOOM_OUT);
}
void DevToolsWindow::ResetZoom() {
chrome_page_zoom::Zoom(web_contents(), content::PAGE_ZOOM_RESET);
}
void DevToolsWindow::FileSavedAs(const std::string& url) { void DevToolsWindow::FileSavedAs(const std::string& url) {
base::StringValue url_value(url); base::StringValue url_value(url);
CallClientFunction("InspectorFrontendAPI.savedURL", &url_value, NULL, NULL); CallClientFunction("InspectorFrontendAPI.savedURL", &url_value, NULL, NULL);
......
...@@ -326,6 +326,9 @@ class DevToolsWindow : private content::NotificationObserver, ...@@ -326,6 +326,9 @@ class DevToolsWindow : private content::NotificationObserver,
virtual void SearchInPath(int request_id, virtual void SearchInPath(int request_id,
const std::string& file_system_path, const std::string& file_system_path,
const std::string& query) OVERRIDE; const std::string& query) OVERRIDE;
virtual void ZoomIn() OVERRIDE;
virtual void ZoomOut() OVERRIDE;
virtual void ResetZoom() OVERRIDE;
// DevToolsFileHelper callbacks. // DevToolsFileHelper callbacks.
void FileSavedAs(const std::string& url); void FileSavedAs(const std::string& url);
......
...@@ -878,16 +878,8 @@ void FindInPage(Browser* browser, bool find_next, bool forward_direction) { ...@@ -878,16 +878,8 @@ void FindInPage(Browser* browser, bool find_next, bool forward_direction) {
} }
void Zoom(Browser* browser, content::PageZoom zoom) { void Zoom(Browser* browser, content::PageZoom zoom) {
WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); chrome_page_zoom::Zoom(browser->tab_strip_model()->GetActiveWebContents(),
DevToolsWindow* devtools = zoom);
DevToolsWindow::GetDockedInstanceForInspectedTab(contents);
if (devtools && devtools->web_contents()->GetRenderWidgetHostView() &&
devtools->web_contents()->GetRenderWidgetHostView()->HasFocus()) {
chrome_page_zoom::Zoom(devtools->web_contents(), zoom);
return;
}
chrome_page_zoom::Zoom(contents, zoom);
} }
void FocusToolbar(Browser* browser) { void FocusToolbar(Browser* browser) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment