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

Side by Side Diff: chrome/browser/devtools/devtools_window.cc

Issue 22972007: Migrate DevToolsWindow from specific to opaque frontend host messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 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
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/devtools/devtools_window.h" 5 #include "chrome/browser/devtools/devtools_window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING, nav_controller_source); 580 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING, nav_controller_source);
581 registrar_.Add( 581 registrar_.Add(
582 this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, 582 this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
583 content::Source<ThemeService>( 583 content::Source<ThemeService>(
584 ThemeServiceFactory::GetForProfile(profile_))); 584 ThemeServiceFactory::GetForProfile(profile_)));
585 585
586 // There is no inspected_rvh in case of shared workers. 586 // There is no inspected_rvh in case of shared workers.
587 if (inspected_rvh) 587 if (inspected_rvh)
588 inspected_contents_observer_.reset(new InspectedWebContentsObserver( 588 inspected_contents_observer_.reset(new InspectedWebContentsObserver(
589 content::WebContents::FromRenderViewHost(inspected_rvh))); 589 content::WebContents::FromRenderViewHost(inspected_rvh)));
590
591 embedder_message_dispatcher_.reset(
592 new DevToolsEmbedderMessageDispatcher(this));
590 } 593 }
591 594
592 // static 595 // static
593 DevToolsWindow* DevToolsWindow::Create( 596 DevToolsWindow* DevToolsWindow::Create(
594 Profile* profile, 597 Profile* profile,
595 const GURL& frontend_url, 598 const GURL& frontend_url,
596 content::RenderViewHost* inspected_rvh, 599 content::RenderViewHost* inspected_rvh,
597 DevToolsDockSide dock_side, 600 DevToolsDockSide dock_side,
598 bool shared_worker_frontend, 601 bool shared_worker_frontend,
599 bool external_frontend) { 602 bool external_frontend) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 } 828 }
826 829
827 void DevToolsWindow::WebContentsFocused(content::WebContents* contents) { 830 void DevToolsWindow::WebContentsFocused(content::WebContents* contents) {
828 Browser* inspected_browser = NULL; 831 Browser* inspected_browser = NULL;
829 int inspected_tab_index = -1; 832 int inspected_tab_index = -1;
830 if (IsDocked() && FindInspectedBrowserAndTabIndex(&inspected_browser, 833 if (IsDocked() && FindInspectedBrowserAndTabIndex(&inspected_browser,
831 &inspected_tab_index)) 834 &inspected_tab_index))
832 inspected_browser->window()->WebContentsFocused(contents); 835 inspected_browser->window()->WebContentsFocused(contents);
833 } 836 }
834 837
838 void DevToolsWindow::DispatchOnEmbedder(const std::string& message) {
839 embedder_message_dispatcher_->Dispatch(message);
840 }
841
835 void DevToolsWindow::ActivateWindow() { 842 void DevToolsWindow::ActivateWindow() {
836 if (IsDocked() && GetInspectedBrowserWindow()) 843 if (IsDocked() && GetInspectedBrowserWindow())
837 web_contents_->GetView()->Focus(); 844 web_contents_->GetView()->Focus();
838 else if (!IsDocked() && !browser_->window()->IsActive()) 845 else if (!IsDocked() && !browser_->window()->IsActive())
839 browser_->window()->Activate(); 846 browser_->window()->Activate();
840 } 847 }
841 848
842 void DevToolsWindow::ChangeAttachedWindowHeight(unsigned height) {
843 NOTREACHED(); // TODO(dgozman): This is not used anymore, remove.
844 }
845
846 void DevToolsWindow::CloseWindow() { 849 void DevToolsWindow::CloseWindow() {
847 DCHECK(IsDocked()); 850 DCHECK(IsDocked());
848 content::DevToolsManager::GetInstance()->ClientHostClosing( 851 content::DevToolsManager::GetInstance()->ClientHostClosing(
849 frontend_host_.get()); 852 frontend_host_.get());
850 Hide(); 853 Hide();
851 } 854 }
852 855
853 void DevToolsWindow::MoveWindow(int x, int y) { 856 void DevToolsWindow::MoveWindow(int x, int y) {
854 if (!IsDocked()) { 857 if (!IsDocked()) {
855 gfx::Rect bounds = browser_->window()->GetBounds(); 858 gfx::Rect bounds = browser_->window()->GetBounds();
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 1328
1326 void DevToolsWindow::Restore() { 1329 void DevToolsWindow::Restore() {
1327 if (dock_side_ == DEVTOOLS_DOCK_SIDE_MINIMIZED) 1330 if (dock_side_ == DEVTOOLS_DOCK_SIDE_MINIMIZED)
1328 SetDockSide(SideToString(dock_side_before_minimized_)); 1331 SetDockSide(SideToString(dock_side_before_minimized_));
1329 } 1332 }
1330 1333
1331 content::WebContents* DevToolsWindow::GetInspectedWebContents() { 1334 content::WebContents* DevToolsWindow::GetInspectedWebContents() {
1332 return inspected_contents_observer_ ? 1335 return inspected_contents_observer_ ?
1333 inspected_contents_observer_->web_contents() : NULL; 1336 inspected_contents_observer_->web_contents() : NULL;
1334 } 1337 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698