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 "chrome/browser/ui/webui/extensions/extensions_ui.h" | 5 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 namespace { | 43 namespace { |
44 | 44 |
45 class ExtensionWebUiTimer : public content::WebContentsObserver { | 45 class ExtensionWebUiTimer : public content::WebContentsObserver { |
46 public: | 46 public: |
47 explicit ExtensionWebUiTimer(content::WebContents* web_contents, bool is_md) | 47 explicit ExtensionWebUiTimer(content::WebContents* web_contents, bool is_md) |
48 : content::WebContentsObserver(web_contents), is_md_(is_md) {} | 48 : content::WebContentsObserver(web_contents), is_md_(is_md) {} |
49 ~ExtensionWebUiTimer() override {} | 49 ~ExtensionWebUiTimer() override {} |
50 | 50 |
51 void DidStartNavigation( | 51 void DidStartNavigation( |
52 content::NavigationHandle* navigation_handle) override { | 52 content::NavigationHandle* navigation_handle) override { |
53 if (navigation_handle->IsInMainFrame() && !navigation_handle->IsSamePage()) | 53 if (navigation_handle->IsInMainFrame() && |
| 54 !navigation_handle->IsSameDocument()) { |
54 timer_.reset(new base::ElapsedTimer()); | 55 timer_.reset(new base::ElapsedTimer()); |
| 56 } |
55 } | 57 } |
56 | 58 |
57 void DocumentLoadedInFrame( | 59 void DocumentLoadedInFrame( |
58 content::RenderFrameHost* render_frame_host) override { | 60 content::RenderFrameHost* render_frame_host) override { |
59 if (render_frame_host != web_contents()->GetMainFrame() || | 61 if (render_frame_host != web_contents()->GetMainFrame() || |
60 !timer_) { // See comment in DocumentOnLoadCompletedInMainFrame() | 62 !timer_) { // See comment in DocumentOnLoadCompletedInMainFrame() |
61 return; | 63 return; |
62 } | 64 } |
63 if (is_md_) { | 65 if (is_md_) { |
64 UMA_HISTOGRAM_TIMES("Extensions.WebUi.DocumentLoadedInMainFrameTime.MD", | 66 UMA_HISTOGRAM_TIMES("Extensions.WebUi.DocumentLoadedInMainFrameTime.MD", |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 ExtensionsUI::~ExtensionsUI() {} | 357 ExtensionsUI::~ExtensionsUI() {} |
356 | 358 |
357 // static | 359 // static |
358 base::RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes( | 360 base::RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes( |
359 ui::ScaleFactor scale_factor) { | 361 ui::ScaleFactor scale_factor) { |
360 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 362 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
361 return rb.LoadDataResourceBytesForScale(IDR_EXTENSIONS_FAVICON, scale_factor); | 363 return rb.LoadDataResourceBytesForScale(IDR_EXTENSIONS_FAVICON, scale_factor); |
362 } | 364 } |
363 | 365 |
364 } // namespace extensions | 366 } // namespace extensions |
OLD | NEW |