| OLD | NEW |
| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 bool docked, | 174 bool docked, |
| 175 bool shared_worker_frontend) { | 175 bool shared_worker_frontend) { |
| 176 // Create TabContents with devtools. | 176 // Create TabContents with devtools. |
| 177 TabContents* tab_contents = | 177 TabContents* tab_contents = |
| 178 chrome::TabContentsFactory(profile, NULL, MSG_ROUTING_NONE, NULL); | 178 chrome::TabContentsFactory(profile, NULL, MSG_ROUTING_NONE, NULL); |
| 179 tab_contents->web_contents()->GetRenderViewHost()->AllowBindings( | 179 tab_contents->web_contents()->GetRenderViewHost()->AllowBindings( |
| 180 content::BINDINGS_POLICY_WEB_UI); | 180 content::BINDINGS_POLICY_WEB_UI); |
| 181 tab_contents->web_contents()->GetController().LoadURL( | 181 tab_contents->web_contents()->GetController().LoadURL( |
| 182 GetDevToolsUrl(profile, docked, shared_worker_frontend), | 182 GetDevToolsUrl(profile, docked, shared_worker_frontend), |
| 183 content::Referrer(), | 183 content::Referrer(), |
| 184 content::PAGE_TRANSITION_START_PAGE, | 184 content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| 185 std::string()); | 185 std::string()); |
| 186 return new DevToolsWindow(tab_contents, profile, inspected_rvh, docked); | 186 return new DevToolsWindow(tab_contents, profile, inspected_rvh, docked); |
| 187 } | 187 } |
| 188 | 188 |
| 189 DevToolsWindow::DevToolsWindow(TabContents* tab_contents, | 189 DevToolsWindow::DevToolsWindow(TabContents* tab_contents, |
| 190 Profile* profile, | 190 Profile* profile, |
| 191 RenderViewHost* inspected_rvh, | 191 RenderViewHost* inspected_rvh, |
| 192 bool docked) | 192 bool docked) |
| 193 : profile_(profile), | 193 : profile_(profile), |
| 194 inspected_tab_(NULL), | 194 inspected_tab_(NULL), |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 defaults->SetInteger("left", 100); | 374 defaults->SetInteger("left", 100); |
| 375 defaults->SetInteger("top", 100); | 375 defaults->SetInteger("top", 100); |
| 376 defaults->SetInteger("right", 740); | 376 defaults->SetInteger("right", 740); |
| 377 defaults->SetInteger("bottom", 740); | 377 defaults->SetInteger("bottom", 740); |
| 378 defaults->SetBoolean("maximized", false); | 378 defaults->SetBoolean("maximized", false); |
| 379 defaults->SetBoolean("always_on_top", false); | 379 defaults->SetBoolean("always_on_top", false); |
| 380 } | 380 } |
| 381 | 381 |
| 382 browser_ = new Browser(Browser::CreateParams::CreateForDevTools(profile_)); | 382 browser_ = new Browser(Browser::CreateParams::CreateForDevTools(profile_)); |
| 383 browser_->tab_strip_model()->AddTabContents( | 383 browser_->tab_strip_model()->AddTabContents( |
| 384 tab_contents_, -1, content::PAGE_TRANSITION_START_PAGE, | 384 tab_contents_, -1, content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| 385 TabStripModel::ADD_ACTIVE); | 385 TabStripModel::ADD_ACTIVE); |
| 386 } | 386 } |
| 387 | 387 |
| 388 bool DevToolsWindow::FindInspectedBrowserAndTabIndex(Browser** browser, | 388 bool DevToolsWindow::FindInspectedBrowserAndTabIndex(Browser** browser, |
| 389 int* tab) { | 389 int* tab) { |
| 390 if (!inspected_tab_) | 390 if (!inspected_tab_) |
| 391 return false; | 391 return false; |
| 392 | 392 |
| 393 for (BrowserList::const_iterator it = BrowserList::begin(); | 393 for (BrowserList::const_iterator it = BrowserList::begin(); |
| 394 it != BrowserList::end(); ++it) { | 394 it != BrowserList::end(); ++it) { |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 FileSelectHelper::RunFileChooser(web_contents, params); | 778 FileSelectHelper::RunFileChooser(web_contents, params); |
| 779 } | 779 } |
| 780 | 780 |
| 781 void DevToolsWindow::UpdateBrowserToolbar() { | 781 void DevToolsWindow::UpdateBrowserToolbar() { |
| 782 if (!inspected_tab_) | 782 if (!inspected_tab_) |
| 783 return; | 783 return; |
| 784 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); | 784 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); |
| 785 if (inspected_window) | 785 if (inspected_window) |
| 786 inspected_window->UpdateToolbar(inspected_tab_, false); | 786 inspected_window->UpdateToolbar(inspected_tab_, false); |
| 787 } | 787 } |
| OLD | NEW |