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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 7779040: Start moving code from BrowserMain to content, so that it can be reused by all embedders of conte... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix windows unittest Created 9 years, 3 months 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/app/breakpad_mac.h" 8 #include "chrome/app/breakpad_mac.h"
9 #include "chrome/browser/browser_about_handler.h" 9 #include "chrome/browser/browser_about_handler.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "content/browser/tab_contents/tab_contents_view.h" 66 #include "content/browser/tab_contents/tab_contents_view.h"
67 #include "content/browser/worker_host/worker_process_host.h" 67 #include "content/browser/worker_host/worker_process_host.h"
68 #include "content/common/desktop_notification_messages.h" 68 #include "content/common/desktop_notification_messages.h"
69 #include "grit/ui_resources.h" 69 #include "grit/ui_resources.h"
70 #include "net/base/cookie_monster.h" 70 #include "net/base/cookie_monster.h"
71 #include "net/base/cookie_options.h" 71 #include "net/base/cookie_options.h"
72 #include "ui/base/resource/resource_bundle.h" 72 #include "ui/base/resource/resource_bundle.h"
73 73
74 #if defined(OS_LINUX) 74 #if defined(OS_LINUX)
75 #include "base/linux_util.h" 75 #include "base/linux_util.h"
76 #include "chrome/browser/browser_main_gtk.h"
76 #include "chrome/browser/crash_handler_host_linux.h" 77 #include "chrome/browser/crash_handler_host_linux.h"
77 #endif 78 #endif
78 79
79 #if defined(TOUCH_UI) 80 #if defined(TOUCH_UI)
80 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h" 81 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h"
81 #elif defined(TOOLKIT_VIEWS) 82 #elif defined(TOOLKIT_VIEWS)
82 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" 83 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
83 #elif defined(OS_LINUX) 84 #elif defined(OS_LINUX)
84 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" 85 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h"
85 #elif defined(OS_MACOSX) 86 #elif defined(OS_MACOSX)
86 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" 87 #include "chrome/browser/tab_contents/tab_contents_view_mac.h"
88 #include "chrome/browser/browser_main_mac.h"
89 #endif
90
91 #if defined(OS_WIN)
92 #include "chrome/browser/browser_main_win.h"
93 #elif defined(OS_CHROMEOS)
94 #include "chrome/browser/chromeos/browser_main_chromeos.h"
87 #endif 95 #endif
88 96
89 #if defined(USE_NSS) 97 #if defined(USE_NSS)
90 #include "chrome/browser/ui/crypto_module_password_dialog.h" 98 #include "chrome/browser/ui/crypto_module_password_dialog.h"
91 #endif 99 #endif
92 100
93 namespace { 101 namespace {
94 102
95 // Handles rewriting Web UI URLs. 103 // Handles rewriting Web UI URLs.
96 static bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { 104 static bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) {
97 if (!ChromeWebUIFactory::GetInstance()->UseWebUIForURL(browser_context, *url)) 105 if (!ChromeWebUIFactory::GetInstance()->UseWebUIForURL(browser_context, *url))
98 return false; 106 return false;
99 107
100 // Special case the new tab page. In older versions of Chrome, the new tab 108 // Special case the new tab page. In older versions of Chrome, the new tab
101 // page was hosted at chrome-internal:<blah>. This might be in people's saved 109 // page was hosted at chrome-internal:<blah>. This might be in people's saved
102 // sessions or bookmarks, so we say any URL with that scheme triggers the new 110 // sessions or bookmarks, so we say any URL with that scheme triggers the new
103 // tab page. 111 // tab page.
104 if (url->SchemeIs(chrome::kChromeInternalScheme)) { 112 if (url->SchemeIs(chrome::kChromeInternalScheme)) {
105 // Rewrite it with the proper new tab URL. 113 // Rewrite it with the proper new tab URL.
106 *url = GURL(chrome::kChromeUINewTabURL); 114 *url = GURL(chrome::kChromeUINewTabURL);
107 } 115 }
108 116
109 return true; 117 return true;
110 } 118 }
111 119
112 } // namespace 120 } // namespace
113 121
114 namespace chrome { 122 namespace chrome {
115 123
124 content::BrowserMainParts* ChromeContentBrowserClient::CreateBrowserMainParts(
125 const MainFunctionParams& parameters) {
126 #if defined(OS_WIN)
127 return new BrowserMainPartsWin(parameters);
128 #elif defined(OS_MACOSX)
129 return new BrowserMainPartsMac(parameters);
130 #elif defined(OS_CHROMEOS)
131 return new BrowserMainPartsChromeos(parameters);
132 #elif defined(OS_LINUX)
133 return new BrowserMainPartsGtk(parameters);
134 #else
135 return NULL;
136 #endif
137 }
138
116 TabContentsView* ChromeContentBrowserClient::CreateTabContentsView( 139 TabContentsView* ChromeContentBrowserClient::CreateTabContentsView(
117 TabContents* tab_contents) { 140 TabContents* tab_contents) {
118 #if defined(TOUCH_UI) 141 #if defined(TOUCH_UI)
119 return new TabContentsViewTouch(tab_contents); 142 return new TabContentsViewTouch(tab_contents);
120 #elif defined(TOOLKIT_VIEWS) 143 #elif defined(TOOLKIT_VIEWS)
121 return new TabContentsViewViews(tab_contents); 144 return new TabContentsViewViews(tab_contents);
122 #elif defined(OS_LINUX) 145 #elif defined(OS_LINUX)
123 return new TabContentsViewGtk(tab_contents); 146 return new TabContentsViewGtk(tab_contents);
124 #elif defined(OS_MACOSX) 147 #elif defined(OS_MACOSX)
125 return tab_contents_view_mac::CreateTabContentsView(tab_contents); 148 return tab_contents_view_mac::CreateTabContentsView(tab_contents);
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 #if defined(USE_NSS) 806 #if defined(USE_NSS)
784 crypto::CryptoModuleBlockingPasswordDelegate* 807 crypto::CryptoModuleBlockingPasswordDelegate*
785 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 808 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
786 const GURL& url) { 809 const GURL& url) {
787 return browser::NewCryptoModuleBlockingDialogDelegate( 810 return browser::NewCryptoModuleBlockingDialogDelegate(
788 browser::kCryptoModulePasswordKeygen, url.host()); 811 browser::kCryptoModulePasswordKeygen, url.host());
789 } 812 }
790 #endif 813 #endif
791 814
792 } // namespace chrome 815 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698