| OLD | NEW |
| 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 #import "chrome/browser/ui/cocoa/hung_renderer_controller.h" | 5 #import "chrome/browser/ui/cocoa/hung_renderer_controller.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| 11 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
| 12 #include "chrome/browser/browser_list.h" | 12 #include "chrome/browser/browser_list.h" |
| 13 #include "chrome/browser/ui/browser_dialogs.h" | 13 #include "chrome/browser/ui/browser_dialogs.h" |
| 14 #import "chrome/browser/ui/cocoa/multi_key_equivalent_button.h" | 14 #import "chrome/browser/ui/cocoa/multi_key_equivalent_button.h" |
| 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 16 #include "chrome/common/logging_chrome.h" | 16 #include "chrome/common/logging_chrome.h" |
| 17 #include "chrome/browser/favicon_tab_helper.h" |
| 17 #include "content/browser/renderer_host/render_process_host.h" | 18 #include "content/browser/renderer_host/render_process_host.h" |
| 18 #include "content/browser/renderer_host/render_view_host.h" | 19 #include "content/browser/renderer_host/render_view_host.h" |
| 19 #include "content/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
| 20 #include "content/common/result_codes.h" | 21 #include "content/common/result_codes.h" |
| 21 #include "grit/chromium_strings.h" | 22 #include "grit/chromium_strings.h" |
| 22 #include "grit/app_resources.h" | 23 #include "grit/app_resources.h" |
| 23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 24 #include "grit/theme_resources.h" | 25 #include "grit/theme_resources.h" |
| 25 #include "skia/ext/skia_utils_mac.h" | 26 #include "skia/ext/skia_utils_mac.h" |
| 26 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 27 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 for (TabContentsIterator it; !it.done(); ++it) { | 141 for (TabContentsIterator it; !it.done(); ++it) { |
| 141 if (it->tab_contents()->GetRenderProcessHost() == | 142 if (it->tab_contents()->GetRenderProcessHost() == |
| 142 hungContents_->GetRenderProcessHost()) { | 143 hungContents_->GetRenderProcessHost()) { |
| 143 string16 title = (*it)->tab_contents()->GetTitle(); | 144 string16 title = (*it)->tab_contents()->GetTitle(); |
| 144 if (title.empty()) | 145 if (title.empty()) |
| 145 title = TabContentsWrapper::GetDefaultTitle(); | 146 title = TabContentsWrapper::GetDefaultTitle(); |
| 146 [titles addObject:base::SysUTF16ToNSString(title)]; | 147 [titles addObject:base::SysUTF16ToNSString(title)]; |
| 147 | 148 |
| 148 // TabContents can return a null SkBitmap if it has no favicon. If this | 149 // TabContents can return a null SkBitmap if it has no favicon. If this |
| 149 // happens, use the default favicon. | 150 // happens, use the default favicon. |
| 150 const SkBitmap& bitmap = it->tab_contents()->GetFavicon(); | 151 const SkBitmap& bitmap = it->favicon_tab_helper()->GetFavicon(); |
| 151 if (!bitmap.isNull()) { | 152 if (!bitmap.isNull()) { |
| 152 [favicons addObject:gfx::SkBitmapToNSImage(bitmap)]; | 153 [favicons addObject:gfx::SkBitmapToNSImage(bitmap)]; |
| 153 } else { | 154 } else { |
| 154 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 155 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 155 [favicons addObject:rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON)]; | 156 [favicons addObject:rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON)]; |
| 156 } | 157 } |
| 157 } | 158 } |
| 158 } | 159 } |
| 159 hungTitles_.reset([titles copy]); | 160 hungTitles_.reset([titles copy]); |
| 160 hungFavicons_.reset([favicons copy]); | 161 hungFavicons_.reset([favicons copy]); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 [g_instance showForTabContents:contents]; | 197 [g_instance showForTabContents:contents]; |
| 197 } | 198 } |
| 198 } | 199 } |
| 199 | 200 |
| 200 void HideHungRendererDialog(TabContents* contents) { | 201 void HideHungRendererDialog(TabContents* contents) { |
| 201 if (!logging::DialogsAreSuppressed() && g_instance) | 202 if (!logging::DialogsAreSuppressed() && g_instance) |
| 202 [g_instance endForTabContents:contents]; | 203 [g_instance endForTabContents:contents]; |
| 203 } | 204 } |
| 204 | 205 |
| 205 } // namespace browser | 206 } // namespace browser |
| OLD | NEW |