Chromium Code Reviews| 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/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 // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 #include "chrome/common/chrome_notification_types.h" | 147 #include "chrome/common/chrome_notification_types.h" |
| 148 #include "chrome/common/chrome_switches.h" | 148 #include "chrome/common/chrome_switches.h" |
| 149 #include "chrome/common/custom_handlers/protocol_handler.h" | 149 #include "chrome/common/custom_handlers/protocol_handler.h" |
| 150 #include "chrome/common/extensions/extension.h" | 150 #include "chrome/common/extensions/extension.h" |
| 151 #include "chrome/common/extensions/extension_constants.h" | 151 #include "chrome/common/extensions/extension_constants.h" |
| 152 #include "chrome/common/pref_names.h" | 152 #include "chrome/common/pref_names.h" |
| 153 #include "chrome/common/profiling.h" | 153 #include "chrome/common/profiling.h" |
| 154 #include "chrome/common/url_constants.h" | 154 #include "chrome/common/url_constants.h" |
| 155 #include "chrome/common/web_apps.h" | 155 #include "chrome/common/web_apps.h" |
| 156 #include "content/public/browser/color_chooser.h" | 156 #include "content/public/browser/color_chooser.h" |
| 157 #include "content/public/browser/devtools_agent_host_registry.h" | |
| 157 #include "content/public/browser/devtools_manager.h" | 158 #include "content/public/browser/devtools_manager.h" |
| 158 #include "content/public/browser/download_item.h" | 159 #include "content/public/browser/download_item.h" |
| 159 #include "content/public/browser/download_manager.h" | 160 #include "content/public/browser/download_manager.h" |
| 160 #include "content/public/browser/interstitial_page.h" | 161 #include "content/public/browser/interstitial_page.h" |
| 161 #include "content/public/browser/invalidate_type.h" | 162 #include "content/public/browser/invalidate_type.h" |
| 162 #include "content/public/browser/navigation_controller.h" | 163 #include "content/public/browser/navigation_controller.h" |
| 163 #include "content/public/browser/navigation_entry.h" | 164 #include "content/public/browser/navigation_entry.h" |
| 164 #include "content/public/browser/notification_details.h" | 165 #include "content/public/browser/notification_details.h" |
| 165 #include "content/public/browser/notification_service.h" | 166 #include "content/public/browser/notification_service.h" |
| 166 #include "content/public/browser/plugin_service.h" | 167 #include "content/public/browser/plugin_service.h" |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 // static | 562 // static |
| 562 void Browser::FormatTitleForDisplay(string16* title) { | 563 void Browser::FormatTitleForDisplay(string16* title) { |
| 563 size_t current_index = 0; | 564 size_t current_index = 0; |
| 564 size_t match_index; | 565 size_t match_index; |
| 565 while ((match_index = title->find(L'\n', current_index)) != string16::npos) { | 566 while ((match_index = title->find(L'\n', current_index)) != string16::npos) { |
| 566 title->replace(match_index, 1, string16()); | 567 title->replace(match_index, 1, string16()); |
| 567 current_index = match_index; | 568 current_index = match_index; |
| 568 } | 569 } |
| 569 } | 570 } |
| 570 | 571 |
| 572 bool Browser::IsDebuggerAttachedForCurrentTab() const { | |
| 573 return content::DevToolsAgentHostRegistry::IsDebuggerAttached( | |
|
pfeldman
2012/07/10 16:44:56
IsDebuggerAttached won't handle 0 web contents.
| |
| 574 chrome::GetActiveWebContents(this)); | |
| 575 } | |
| 576 | |
| 571 /////////////////////////////////////////////////////////////////////////////// | 577 /////////////////////////////////////////////////////////////////////////////// |
| 572 // Browser, OnBeforeUnload handling: | 578 // Browser, OnBeforeUnload handling: |
| 573 | 579 |
| 574 bool Browser::ShouldCloseWindow() { | 580 bool Browser::ShouldCloseWindow() { |
| 575 if (!CanCloseWithInProgressDownloads()) | 581 if (!CanCloseWithInProgressDownloads()) |
| 576 return false; | 582 return false; |
| 577 | 583 |
| 578 if (HasCompletedUnloadProcessing()) | 584 if (HasCompletedUnloadProcessing()) |
| 579 return true; | 585 return true; |
| 580 | 586 |
| (...skipping 2150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2731 if (contents && !allow_js_access) { | 2737 if (contents && !allow_js_access) { |
| 2732 contents->web_contents()->GetController().LoadURL( | 2738 contents->web_contents()->GetController().LoadURL( |
| 2733 target_url, | 2739 target_url, |
| 2734 content::Referrer(), | 2740 content::Referrer(), |
| 2735 content::PAGE_TRANSITION_LINK, | 2741 content::PAGE_TRANSITION_LINK, |
| 2736 std::string()); // No extra headers. | 2742 std::string()); // No extra headers. |
| 2737 } | 2743 } |
| 2738 | 2744 |
| 2739 return contents != NULL; | 2745 return contents != NULL; |
| 2740 } | 2746 } |
| OLD | NEW |