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

Side by Side Diff: android_webview/lib/main/aw_main_delegate.cc

Issue 11471040: [Android WebView] Convert context menu callback to long press (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Lazy initialize to fix crash. Created 8 years 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 | Annotate | Revision Log
OLDNEW
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 "android_webview/lib/main/aw_main_delegate.h" 5 #include "android_webview/lib/main/aw_main_delegate.h"
6 6
7 #include "android_webview/browser/aw_content_browser_client.h"
8 #include "android_webview/lib/aw_browser_dependency_factory_impl.h" 7 #include "android_webview/lib/aw_browser_dependency_factory_impl.h"
8 #include "android_webview/native/aw_web_contents_view_delegate.h"
9 #include "android_webview/renderer/aw_content_renderer_client.h" 9 #include "android_webview/renderer/aw_content_renderer_client.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "content/public/browser/browser_main_runner.h" 13 #include "content/public/browser/browser_main_runner.h"
14 14
15 namespace android_webview { 15 namespace android_webview {
16 16
17 base::LazyInstance<AwContentBrowserClient>
18 g_webview_content_browser_client = LAZY_INSTANCE_INITIALIZER;
19 base::LazyInstance<AwContentRendererClient> 17 base::LazyInstance<AwContentRendererClient>
20 g_webview_content_renderer_client = LAZY_INSTANCE_INITIALIZER; 18 g_webview_content_renderer_client = LAZY_INSTANCE_INITIALIZER;
21 19
22 AwMainDelegate::AwMainDelegate() { 20 AwMainDelegate::AwMainDelegate() {
23 } 21 }
24 22
25 AwMainDelegate::~AwMainDelegate() { 23 AwMainDelegate::~AwMainDelegate() {
26 } 24 }
27 25
28 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { 26 bool AwMainDelegate::BasicStartupComplete(int* exit_code) {
(...skipping 30 matching lines...) Expand all
59 } 57 }
60 58
61 void AwMainDelegate::ProcessExiting(const std::string& process_type) { 59 void AwMainDelegate::ProcessExiting(const std::string& process_type) {
62 // TODO(torne): Clean up resources when we handle them. 60 // TODO(torne): Clean up resources when we handle them.
63 61
64 logging::CloseLogFile(); 62 logging::CloseLogFile();
65 } 63 }
66 64
67 content::ContentBrowserClient* 65 content::ContentBrowserClient*
68 AwMainDelegate::CreateContentBrowserClient() { 66 AwMainDelegate::CreateContentBrowserClient() {
69 return &g_webview_content_browser_client.Get(); 67 if (!content_browser_client_) {
68 content_browser_client_.reset(
69 new AwContentBrowserClient(&AwWebContentsViewDelegate::Create));
70 }
71
72 return content_browser_client_.get();
70 } 73 }
71 74
72 content::ContentRendererClient* 75 content::ContentRendererClient*
73 AwMainDelegate::CreateContentRendererClient() { 76 AwMainDelegate::CreateContentRendererClient() {
74 return &g_webview_content_renderer_client.Get(); 77 return &g_webview_content_renderer_client.Get();
75 } 78 }
76 79
77 } // namespace android_webview 80 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698