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

Side by Side Diff: chrome/browser/extensions/bookmark_app_helper.cc

Issue 1432143002: Track where WebContents are created in order to better understand issue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 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/extensions/bookmark_app_helper.h" 5 #include "chrome/browser/extensions/bookmark_app_helper.h"
6 6
7 #include <cctype> 7 #include <cctype>
8 #include <string> 8 #include <string>
9 9
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/ui/browser_window.h" 24 #include "chrome/browser/ui/browser_window.h"
25 #include "chrome/browser/ui/host_desktop.h" 25 #include "chrome/browser/ui/host_desktop.h"
26 #include "chrome/browser/web_applications/web_app.h" 26 #include "chrome/browser/web_applications/web_app.h"
27 #include "chrome/common/extensions/extension_constants.h" 27 #include "chrome/common/extensions/extension_constants.h"
28 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 28 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
29 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
30 #include "content/public/browser/navigation_controller.h" 30 #include "content/public/browser/navigation_controller.h"
31 #include "content/public/browser/notification_service.h" 31 #include "content/public/browser/notification_service.h"
32 #include "content/public/browser/notification_source.h" 32 #include "content/public/browser/notification_source.h"
33 #include "content/public/browser/web_contents.h" 33 #include "content/public/browser/web_contents.h"
34 #include "content/public/browser/web_contents_source.h"
34 #include "extensions/browser/extension_registry.h" 35 #include "extensions/browser/extension_registry.h"
35 #include "extensions/browser/extension_system.h" 36 #include "extensions/browser/extension_system.h"
36 #include "extensions/browser/image_loader.h" 37 #include "extensions/browser/image_loader.h"
37 #include "extensions/browser/notification_types.h" 38 #include "extensions/browser/notification_types.h"
38 #include "extensions/browser/pref_names.h" 39 #include "extensions/browser/pref_names.h"
39 #include "extensions/common/constants.h" 40 #include "extensions/common/constants.h"
40 #include "extensions/common/extension.h" 41 #include "extensions/common/extension.h"
41 #include "extensions/common/manifest_handlers/icons_handler.h" 42 #include "extensions/common/manifest_handlers/icons_handler.h"
42 #include "extensions/common/url_pattern.h" 43 #include "extensions/common/url_pattern.h"
43 #include "grit/platform_locale_settings.h" 44 #include "grit/platform_locale_settings.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // missing icons which are not correctly extracted from a favicon. 243 // missing icons which are not correctly extracted from a favicon.
243 // (The eventual error indicates that there are missing files, which 244 // (The eventual error indicates that there are missing files, which
244 // are the not-extracted favicon images). 245 // are the not-extracted favicon images).
245 // 246 //
246 // TODO(dominickn): refactor bookmark app syncing to reuse one web 247 // TODO(dominickn): refactor bookmark app syncing to reuse one web
247 // contents for all pending synced bookmark apps. This will avoid 248 // contents for all pending synced bookmark apps. This will avoid
248 // pathological cases where n renderers for n bookmark apps are spun up on 249 // pathological cases where n renderers for n bookmark apps are spun up on
249 // first sign-in to a new machine. 250 // first sign-in to a new machine.
250 web_contents_.reset(content::WebContents::Create( 251 web_contents_.reset(content::WebContents::Create(
251 content::WebContents::CreateParams(service_->profile()))); 252 content::WebContents::CreateParams(service_->profile())));
253 WebContentsSource::CreateForWebContentsAndLocation(web_contents_.get(),
254 FROM_HERE);
252 Observe(web_contents_.get()); 255 Observe(web_contents_.get());
253 256
254 // Load about:blank so that the process actually starts. 257 // Load about:blank so that the process actually starts.
255 // Image download continues in DidFinishLoad. 258 // Image download continues in DidFinishLoad.
256 content::NavigationController::LoadURLParams load_params( 259 content::NavigationController::LoadURLParams load_params(
257 GURL("about:blank")); 260 GURL("about:blank"));
258 load_params.transition_type = ui::PAGE_TRANSITION_GENERATED; 261 load_params.transition_type = ui::PAGE_TRANSITION_GENERATED;
259 web_contents_->GetController().LoadURLWithParams(load_params); 262 web_contents_->GetController().LoadURLWithParams(load_params);
260 } 263 }
261 264
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); 798 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback));
796 } 799 }
797 800
798 bool IsValidBookmarkAppUrl(const GURL& url) { 801 bool IsValidBookmarkAppUrl(const GURL& url) {
799 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes); 802 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes);
800 origin_only_pattern.SetMatchAllURLs(true); 803 origin_only_pattern.SetMatchAllURLs(true);
801 return url.is_valid() && origin_only_pattern.MatchesURL(url); 804 return url.is_valid() && origin_only_pattern.MatchesURL(url);
802 } 805 }
803 806
804 } // namespace extensions 807 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698