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 "extensions/browser/extension_host.h" | 5 #include "extensions/browser/extension_host.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 browser_context_(site_instance->GetBrowserContext()), | 61 browser_context_(site_instance->GetBrowserContext()), |
62 render_view_host_(nullptr), | 62 render_view_host_(nullptr), |
63 is_render_view_creation_pending_(false), | 63 is_render_view_creation_pending_(false), |
64 has_loaded_once_(false), | 64 has_loaded_once_(false), |
65 document_element_available_(false), | 65 document_element_available_(false), |
66 initial_url_(url), | 66 initial_url_(url), |
67 extension_host_type_(host_type) { | 67 extension_host_type_(host_type) { |
68 // Not used for panels, see PanelHost. | 68 // Not used for panels, see PanelHost. |
69 DCHECK(host_type == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE || | 69 DCHECK(host_type == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE || |
70 host_type == VIEW_TYPE_EXTENSION_DIALOG || | 70 host_type == VIEW_TYPE_EXTENSION_DIALOG || |
71 host_type == VIEW_TYPE_EXTENSION_POPUP); | 71 host_type == VIEW_TYPE_EXTENSION_POPUP || |
| 72 host_type == VIEW_TYPE_EXTENSION_SIDEBAR); |
72 host_contents_.reset(WebContents::Create( | 73 host_contents_.reset(WebContents::Create( |
73 WebContents::CreateParams(browser_context_, site_instance))), | 74 WebContents::CreateParams(browser_context_, site_instance))); |
74 content::WebContentsObserver::Observe(host_contents_.get()); | 75 content::WebContentsObserver::Observe(host_contents_.get()); |
75 host_contents_->SetDelegate(this); | 76 host_contents_->SetDelegate(this); |
76 SetViewType(host_contents_.get(), host_type); | 77 SetViewType(host_contents_.get(), host_type); |
77 | 78 |
78 render_view_host_ = host_contents_->GetRenderViewHost(); | 79 render_view_host_ = host_contents_->GetRenderViewHost(); |
79 | 80 |
80 // Listen for when an extension is unloaded from the same profile, as it may | 81 // Listen for when an extension is unloaded from the same profile, as it may |
81 // be the same extension that this points to. | 82 // be the same extension that this points to. |
82 ExtensionRegistry::Get(browser_context_)->AddObserver(this); | 83 ExtensionRegistry::Get(browser_context_)->AddObserver(this); |
83 | 84 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 } | 487 } |
487 } else if (extension_host_type_ == VIEW_TYPE_EXTENSION_POPUP) { | 488 } else if (extension_host_type_ == VIEW_TYPE_EXTENSION_POPUP) { |
488 UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.PopupLoadTime2", | 489 UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.PopupLoadTime2", |
489 load_start_->Elapsed()); | 490 load_start_->Elapsed()); |
490 UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.PopupCreateTime", | 491 UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.PopupCreateTime", |
491 create_start_.Elapsed()); | 492 create_start_.Elapsed()); |
492 } | 493 } |
493 } | 494 } |
494 | 495 |
495 } // namespace extensions | 496 } // namespace extensions |
OLD | NEW |