OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ui_bindings.h" | 5 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
16 #include "chrome/browser/chrome_page_zoom.h" | 16 #include "chrome/browser/chrome_page_zoom.h" |
17 #include "chrome/browser/devtools/devtools_target_impl.h" | 17 #include "chrome/browser/devtools/devtools_target_impl.h" |
18 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | |
19 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
20 #include "chrome/browser/infobars/infobar_service.h" | 19 #include "chrome/browser/infobars/infobar_service.h" |
21 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/themes/theme_properties.h" | 21 #include "chrome/browser/themes/theme_properties.h" |
23 #include "chrome/browser/themes/theme_service.h" | 22 #include "chrome/browser/themes/theme_service.h" |
24 #include "chrome/browser/themes/theme_service_factory.h" | 23 #include "chrome/browser/themes/theme_service_factory.h" |
25 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
26 #include "chrome/browser/ui/browser_iterator.h" | 25 #include "chrome/browser/ui/browser_iterator.h" |
27 #include "chrome/browser/ui/browser_list.h" | 26 #include "chrome/browser/ui/browser_list.h" |
28 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
(...skipping 17 matching lines...) Expand all Loading... |
46 #include "content/public/browser/web_contents_observer.h" | 45 #include "content/public/browser/web_contents_observer.h" |
47 #include "content/public/common/page_transition_types.h" | 46 #include "content/public/common/page_transition_types.h" |
48 #include "content/public/common/renderer_preferences.h" | 47 #include "content/public/common/renderer_preferences.h" |
49 #include "content/public/common/url_constants.h" | 48 #include "content/public/common/url_constants.h" |
50 #include "extensions/browser/extension_system.h" | 49 #include "extensions/browser/extension_system.h" |
51 #include "extensions/common/extension_set.h" | 50 #include "extensions/common/extension_set.h" |
52 #include "extensions/common/permissions/permissions_data.h" | 51 #include "extensions/common/permissions/permissions_data.h" |
53 #include "grit/generated_resources.h" | 52 #include "grit/generated_resources.h" |
54 #include "ui/base/l10n/l10n_util.h" | 53 #include "ui/base/l10n/l10n_util.h" |
55 | 54 |
| 55 #if defined(ENABLE_EXTENSIONS) |
| 56 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
| 57 #endif |
| 58 |
56 using base::DictionaryValue; | 59 using base::DictionaryValue; |
57 using content::BrowserThread; | 60 using content::BrowserThread; |
58 | 61 |
59 namespace { | 62 namespace { |
60 | 63 |
61 static const char kFrontendHostId[] = "id"; | 64 static const char kFrontendHostId[] = "id"; |
62 static const char kFrontendHostMethod[] = "method"; | 65 static const char kFrontendHostMethod[] = "method"; |
63 static const char kFrontendHostParams[] = "params"; | 66 static const char kFrontendHostParams[] = "params"; |
64 static const char kTitleFormat[] = "Developer Tools - %s"; | 67 static const char kTitleFormat[] = "Developer Tools - %s"; |
65 | 68 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 device_listener_enabled_(false), | 313 device_listener_enabled_(false), |
311 url_(url), | 314 url_(url), |
312 weak_factory_(this) { | 315 weak_factory_(this) { |
313 frontend_contents_observer_.reset(new FrontendWebContentsObserver(this)); | 316 frontend_contents_observer_.reset(new FrontendWebContentsObserver(this)); |
314 web_contents_->GetMutableRendererPrefs()->can_accept_load_drops = false; | 317 web_contents_->GetMutableRendererPrefs()->can_accept_load_drops = false; |
315 | 318 |
316 frontend_host_.reset(content::DevToolsClientHost::CreateDevToolsFrontendHost( | 319 frontend_host_.reset(content::DevToolsClientHost::CreateDevToolsFrontendHost( |
317 web_contents_, this)); | 320 web_contents_, this)); |
318 file_helper_.reset(new DevToolsFileHelper(web_contents_, profile_)); | 321 file_helper_.reset(new DevToolsFileHelper(web_contents_, profile_)); |
319 file_system_indexer_ = new DevToolsFileSystemIndexer(); | 322 file_system_indexer_ = new DevToolsFileSystemIndexer(); |
| 323 #if defined(ENABLE_EXTENSIONS) |
320 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( | 324 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( |
321 web_contents_); | 325 web_contents_); |
| 326 #endif |
322 | 327 |
323 web_contents_->GetController().LoadURL( | 328 web_contents_->GetController().LoadURL( |
324 url, content::Referrer(), | 329 url, content::Referrer(), |
325 content::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); | 330 content::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); |
326 | 331 |
327 // Wipe out page icon so that the default application icon is used. | 332 // Wipe out page icon so that the default application icon is used. |
328 content::NavigationEntry* entry = | 333 content::NavigationEntry* entry = |
329 web_contents_->GetController().GetActiveEntry(); | 334 web_contents_->GetController().GetActiveEntry(); |
330 entry->GetFavicon().image = gfx::Image(); | 335 entry->GetFavicon().image = gfx::Image(); |
331 entry->GetFavicon().valid = true; | 336 entry->GetFavicon().valid = true; |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 NULL); | 811 NULL); |
807 } | 812 } |
808 | 813 |
809 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { | 814 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { |
810 // Call delegate first - it seeds importants bit of information. | 815 // Call delegate first - it seeds importants bit of information. |
811 delegate_->OnLoadCompleted(); | 816 delegate_->OnLoadCompleted(); |
812 | 817 |
813 UpdateTheme(); | 818 UpdateTheme(); |
814 AddDevToolsExtensionsToClient(); | 819 AddDevToolsExtensionsToClient(); |
815 } | 820 } |
OLD | NEW |