| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 browser_context_(site_instance->GetBrowserContext()), | 60 browser_context_(site_instance->GetBrowserContext()), |
| 61 render_view_host_(nullptr), | 61 render_view_host_(nullptr), |
| 62 has_loaded_once_(false), | 62 has_loaded_once_(false), |
| 63 document_element_available_(false), | 63 document_element_available_(false), |
| 64 initial_url_(url), | 64 initial_url_(url), |
| 65 extension_function_dispatcher_(browser_context_, this), | 65 extension_function_dispatcher_(browser_context_, this), |
| 66 extension_host_type_(host_type) { | 66 extension_host_type_(host_type) { |
| 67 // Not used for panels, see PanelHost. | 67 // Not used for panels, see PanelHost. |
| 68 DCHECK(host_type == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE || | 68 DCHECK(host_type == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE || |
| 69 host_type == VIEW_TYPE_EXTENSION_DIALOG || | 69 host_type == VIEW_TYPE_EXTENSION_DIALOG || |
| 70 host_type == VIEW_TYPE_EXTENSION_POPUP); | 70 host_type == VIEW_TYPE_EXTENSION_POPUP || |
| 71 host_type == VIEW_TYPE_EXTENSION_SIDEBAR); |
| 71 host_contents_.reset(WebContents::Create( | 72 host_contents_.reset(WebContents::Create( |
| 72 WebContents::CreateParams(browser_context_, site_instance))), | 73 WebContents::CreateParams(browser_context_, site_instance))); |
| 73 content::WebContentsObserver::Observe(host_contents_.get()); | 74 content::WebContentsObserver::Observe(host_contents_.get()); |
| 74 host_contents_->SetDelegate(this); | 75 host_contents_->SetDelegate(this); |
| 75 SetViewType(host_contents_.get(), host_type); | 76 SetViewType(host_contents_.get(), host_type); |
| 76 | 77 |
| 77 render_view_host_ = host_contents_->GetRenderViewHost(); | 78 render_view_host_ = host_contents_->GetRenderViewHost(); |
| 78 | 79 |
| 79 // Listen for when an extension is unloaded from the same profile, as it may | 80 // Listen for when an extension is unloaded from the same profile, as it may |
| 80 // be the same extension that this points to. | 81 // be the same extension that this points to. |
| 81 ExtensionRegistry::Get(browser_context_)->AddObserver(this); | 82 ExtensionRegistry::Get(browser_context_)->AddObserver(this); |
| 82 | 83 |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 } | 471 } |
| 471 } else if (extension_host_type_ == VIEW_TYPE_EXTENSION_POPUP) { | 472 } else if (extension_host_type_ == VIEW_TYPE_EXTENSION_POPUP) { |
| 472 UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.PopupLoadTime2", | 473 UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.PopupLoadTime2", |
| 473 load_start_->Elapsed()); | 474 load_start_->Elapsed()); |
| 474 UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.PopupCreateTime", | 475 UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.PopupCreateTime", |
| 475 create_start_.Elapsed()); | 476 create_start_.Elapsed()); |
| 476 } | 477 } |
| 477 } | 478 } |
| 478 | 479 |
| 479 } // namespace extensions | 480 } // namespace extensions |
| OLD | NEW |