| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
| (...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 | 1589 |
| 1590 void Browser::DidNavigateToPendingEntry(WebContents* web_contents) { | 1590 void Browser::DidNavigateToPendingEntry(WebContents* web_contents) { |
| 1591 if (web_contents == tab_strip_model_->GetActiveWebContents()) | 1591 if (web_contents == tab_strip_model_->GetActiveWebContents()) |
| 1592 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); | 1592 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); |
| 1593 } | 1593 } |
| 1594 | 1594 |
| 1595 content::JavaScriptDialogManager* Browser::GetJavaScriptDialogManager() { | 1595 content::JavaScriptDialogManager* Browser::GetJavaScriptDialogManager() { |
| 1596 return GetJavaScriptDialogManagerInstance(); | 1596 return GetJavaScriptDialogManagerInstance(); |
| 1597 } | 1597 } |
| 1598 | 1598 |
| 1599 content::ColorChooser* Browser::OpenColorChooser(WebContents* web_contents, | 1599 content::ColorChooser* Browser::OpenColorChooser( |
| 1600 SkColor initial_color) { | 1600 WebContents* web_contents, |
| 1601 SkColor initial_color, |
| 1602 const std::vector<content::ColorSuggestion>& suggestions) { |
| 1601 return chrome::ShowColorChooser(web_contents, initial_color); | 1603 return chrome::ShowColorChooser(web_contents, initial_color); |
| 1602 } | 1604 } |
| 1603 | 1605 |
| 1604 void Browser::RunFileChooser(WebContents* web_contents, | 1606 void Browser::RunFileChooser(WebContents* web_contents, |
| 1605 const content::FileChooserParams& params) { | 1607 const content::FileChooserParams& params) { |
| 1606 FileSelectHelper::RunFileChooser(web_contents, params); | 1608 FileSelectHelper::RunFileChooser(web_contents, params); |
| 1607 } | 1609 } |
| 1608 | 1610 |
| 1609 void Browser::EnumerateDirectory(WebContents* web_contents, | 1611 void Browser::EnumerateDirectory(WebContents* web_contents, |
| 1610 int request_id, | 1612 int request_id, |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2263 bool allow_js_access = extensions::BackgroundInfo::AllowJSAccess(extension); | 2265 bool allow_js_access = extensions::BackgroundInfo::AllowJSAccess(extension); |
| 2264 BackgroundContents* existing = | 2266 BackgroundContents* existing = |
| 2265 service->GetAppBackgroundContents(ASCIIToUTF16(extension->id())); | 2267 service->GetAppBackgroundContents(ASCIIToUTF16(extension->id())); |
| 2266 if (existing) { | 2268 if (existing) { |
| 2267 // For non-scriptable background contents, ignore the request altogether, | 2269 // For non-scriptable background contents, ignore the request altogether, |
| 2268 // (returning true, so that a regular WebContents isn't created either). | 2270 // (returning true, so that a regular WebContents isn't created either). |
| 2269 if (!allow_js_access) | 2271 if (!allow_js_access) |
| 2270 return true; | 2272 return true; |
| 2271 // For scriptable background pages, if one already exists, close it (even | 2273 // For scriptable background pages, if one already exists, close it (even |
| 2272 // if it was specified in the manifest). | 2274 // if it was specified in the manifest). |
| 2273 DLOG(INFO) << "Closing existing BackgroundContents for " << opener_url; | |
| 2274 delete existing; | 2275 delete existing; |
| 2275 } | 2276 } |
| 2276 | 2277 |
| 2277 // If script access is not allowed, create the the background contents in a | 2278 // If script access is not allowed, create the the background contents in a |
| 2278 // new SiteInstance, so that a separate process is used. | 2279 // new SiteInstance, so that a separate process is used. |
| 2279 scoped_refptr<content::SiteInstance> site_instance = | 2280 scoped_refptr<content::SiteInstance> site_instance = |
| 2280 allow_js_access ? | 2281 allow_js_access ? |
| 2281 opener_site_instance : | 2282 opener_site_instance : |
| 2282 content::SiteInstance::Create(opener_web_contents->GetBrowserContext()); | 2283 content::SiteInstance::Create(opener_web_contents->GetBrowserContext()); |
| 2283 | 2284 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2296 if (contents && !allow_js_access) { | 2297 if (contents && !allow_js_access) { |
| 2297 contents->web_contents()->GetController().LoadURL( | 2298 contents->web_contents()->GetController().LoadURL( |
| 2298 target_url, | 2299 target_url, |
| 2299 content::Referrer(), | 2300 content::Referrer(), |
| 2300 content::PAGE_TRANSITION_LINK, | 2301 content::PAGE_TRANSITION_LINK, |
| 2301 std::string()); // No extra headers. | 2302 std::string()); // No extra headers. |
| 2302 } | 2303 } |
| 2303 | 2304 |
| 2304 return contents != NULL; | 2305 return contents != NULL; |
| 2305 } | 2306 } |
| OLD | NEW |