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

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

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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
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/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 26 matching lines...) Expand all
37 #include "content/public/browser/native_web_keyboard_event.h" 37 #include "content/public/browser/native_web_keyboard_event.h"
38 #include "content/public/browser/navigation_controller.h" 38 #include "content/public/browser/navigation_controller.h"
39 #include "content/public/browser/navigation_entry.h" 39 #include "content/public/browser/navigation_entry.h"
40 #include "content/public/browser/render_frame_host.h" 40 #include "content/public/browser/render_frame_host.h"
41 #include "content/public/browser/render_process_host.h" 41 #include "content/public/browser/render_process_host.h"
42 #include "content/public/browser/render_view_host.h" 42 #include "content/public/browser/render_view_host.h"
43 #include "content/public/browser/render_widget_host_view.h" 43 #include "content/public/browser/render_widget_host_view.h"
44 #include "content/public/browser/user_metrics.h" 44 #include "content/public/browser/user_metrics.h"
45 #include "content/public/browser/web_contents.h" 45 #include "content/public/browser/web_contents.h"
46 #include "content/public/common/content_client.h" 46 #include "content/public/common/content_client.h"
47 #include "content/public/common/page_transition_types.h"
48 #include "content/public/common/url_constants.h" 47 #include "content/public/common/url_constants.h"
49 #include "third_party/WebKit/public/web/WebInputEvent.h" 48 #include "third_party/WebKit/public/web/WebInputEvent.h"
49 #include "ui/base/page_transition_types.h"
50 #include "ui/events/keycodes/keyboard_codes.h" 50 #include "ui/events/keycodes/keyboard_codes.h"
51 51
52 using base::DictionaryValue; 52 using base::DictionaryValue;
53 using blink::WebInputEvent; 53 using blink::WebInputEvent;
54 using content::BrowserThread; 54 using content::BrowserThread;
55 using content::DevToolsAgentHost; 55 using content::DevToolsAgentHost;
56 using content::WebContents; 56 using content::WebContents;
57 57
58 namespace { 58 namespace {
59 59
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 // Passing "dockSide=undocked" parameter ensures proper UI. 677 // Passing "dockSide=undocked" parameter ensures proper UI.
678 life_stage_(can_dock ? kNotLoaded : kIsDockedSet), 678 life_stage_(can_dock ? kNotLoaded : kIsDockedSet),
679 action_on_load_(DevToolsToggleAction::NoOp()), 679 action_on_load_(DevToolsToggleAction::NoOp()),
680 intercepted_page_beforeunload_(false) { 680 intercepted_page_beforeunload_(false) {
681 // Set up delegate, so we get fully-functional window immediately. 681 // Set up delegate, so we get fully-functional window immediately.
682 // It will not appear in UI though until |life_stage_ == kLoadCompleted|. 682 // It will not appear in UI though until |life_stage_ == kLoadCompleted|.
683 main_web_contents_->SetDelegate(this); 683 main_web_contents_->SetDelegate(this);
684 684
685 main_web_contents_->GetController().LoadURL( 685 main_web_contents_->GetController().LoadURL(
686 DevToolsUIBindings::ApplyThemeToURL(profile, url), content::Referrer(), 686 DevToolsUIBindings::ApplyThemeToURL(profile, url), content::Referrer(),
687 content::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); 687 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string());
688 688
689 bindings_ = DevToolsUIBindings::ForWebContents(main_web_contents_); 689 bindings_ = DevToolsUIBindings::ForWebContents(main_web_contents_);
690 DCHECK(bindings_); 690 DCHECK(bindings_);
691 691
692 // Bindings take ownership over devtools as its delegate. 692 // Bindings take ownership over devtools as its delegate.
693 bindings_->SetDelegate(this); 693 bindings_->SetDelegate(this);
694 // DevTools uses chrome_page_zoom::Zoom(), so main_web_contents_ requires a 694 // DevTools uses chrome_page_zoom::Zoom(), so main_web_contents_ requires a
695 // ZoomController. 695 // ZoomController.
696 ZoomController::CreateForWebContents(main_web_contents_); 696 ZoomController::CreateForWebContents(main_web_contents_);
697 ZoomController::FromWebContents(main_web_contents_) 697 ZoomController::FromWebContents(main_web_contents_)
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 } else if (!dock_requested && was_docked) { 1037 } else if (!dock_requested && was_docked) {
1038 UpdateBrowserWindow(); 1038 UpdateBrowserWindow();
1039 } 1039 }
1040 1040
1041 Show(DevToolsToggleAction::Show()); 1041 Show(DevToolsToggleAction::Show());
1042 } 1042 }
1043 1043
1044 void DevToolsWindow::OpenInNewTab(const std::string& url) { 1044 void DevToolsWindow::OpenInNewTab(const std::string& url) {
1045 content::OpenURLParams params( 1045 content::OpenURLParams params(
1046 GURL(url), content::Referrer(), NEW_FOREGROUND_TAB, 1046 GURL(url), content::Referrer(), NEW_FOREGROUND_TAB,
1047 content::PAGE_TRANSITION_LINK, false); 1047 ui::PAGE_TRANSITION_LINK, false);
1048 WebContents* inspected_web_contents = GetInspectedWebContents(); 1048 WebContents* inspected_web_contents = GetInspectedWebContents();
1049 if (inspected_web_contents) { 1049 if (inspected_web_contents) {
1050 inspected_web_contents->OpenURL(params); 1050 inspected_web_contents->OpenURL(params);
1051 } else { 1051 } else {
1052 chrome::HostDesktopType host_desktop_type; 1052 chrome::HostDesktopType host_desktop_type;
1053 if (browser_) { 1053 if (browser_) {
1054 host_desktop_type = browser_->host_desktop_type(); 1054 host_desktop_type = browser_->host_desktop_type();
1055 } else { 1055 } else {
1056 // There should always be a browser when there are no inspected web 1056 // There should always be a browser when there are no inspected web
1057 // contents. 1057 // contents.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 dev_tools_defaults->SetInteger("bottom", 740); 1135 dev_tools_defaults->SetInteger("bottom", 740);
1136 dev_tools_defaults->SetBoolean("maximized", false); 1136 dev_tools_defaults->SetBoolean("maximized", false);
1137 dev_tools_defaults->SetBoolean("always_on_top", false); 1137 dev_tools_defaults->SetBoolean("always_on_top", false);
1138 } 1138 }
1139 1139
1140 browser_ = new Browser(Browser::CreateParams::CreateForDevTools( 1140 browser_ = new Browser(Browser::CreateParams::CreateForDevTools(
1141 profile_, 1141 profile_,
1142 chrome::GetHostDesktopTypeForNativeView( 1142 chrome::GetHostDesktopTypeForNativeView(
1143 main_web_contents_->GetNativeView()))); 1143 main_web_contents_->GetNativeView())));
1144 browser_->tab_strip_model()->AddWebContents( 1144 browser_->tab_strip_model()->AddWebContents(
1145 main_web_contents_, -1, content::PAGE_TRANSITION_AUTO_TOPLEVEL, 1145 main_web_contents_, -1, ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
1146 TabStripModel::ADD_ACTIVE); 1146 TabStripModel::ADD_ACTIVE);
1147 main_web_contents_->GetRenderViewHost()->SyncRendererPrefs(); 1147 main_web_contents_->GetRenderViewHost()->SyncRendererPrefs();
1148 } 1148 }
1149 1149
1150 BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() { 1150 BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() {
1151 Browser* browser = NULL; 1151 Browser* browser = NULL;
1152 int tab; 1152 int tab;
1153 return FindInspectedBrowserAndTabIndex(GetInspectedWebContents(), 1153 return FindInspectedBrowserAndTabIndex(GetInspectedWebContents(),
1154 &browser, &tab) ? 1154 &browser, &tab) ?
1155 browser->window() : NULL; 1155 browser->window() : NULL;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 closure.Run(); 1223 closure.Run();
1224 return; 1224 return;
1225 } 1225 }
1226 load_completed_callback_ = closure; 1226 load_completed_callback_ = closure;
1227 } 1227 }
1228 1228
1229 bool DevToolsWindow::ForwardKeyboardEvent( 1229 bool DevToolsWindow::ForwardKeyboardEvent(
1230 const content::NativeWebKeyboardEvent& event) { 1230 const content::NativeWebKeyboardEvent& event) {
1231 return event_forwarder_->ForwardEvent(event); 1231 return event_forwarder_->ForwardEvent(event);
1232 } 1232 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698