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 #include "chrome/browser/ui/webui/hung_renderer_dialog.h" | 5 #include "chrome/browser/ui/webui/hung_renderer_dialog.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
17 #include "chrome/browser/ui/browser_dialogs.h" | 17 #include "chrome/browser/ui/browser_dialogs.h" |
| 18 #include "chrome/browser/ui/dialog_style.h" |
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
19 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 20 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
20 #include "chrome/common/logging_chrome.h" | 21 #include "chrome/common/logging_chrome.h" |
21 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
22 #include "content/browser/renderer_host/render_view_host.h" | 23 #include "content/browser/renderer_host/render_view_host.h" |
23 #include "content/browser/tab_contents/tab_contents.h" | 24 #include "content/browser/tab_contents/tab_contents.h" |
24 #include "content/public/common/result_codes.h" | 25 #include "content/public/common/result_codes.h" |
25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
27 | 28 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 g_instance->ShowDialog(contents); | 115 g_instance->ShowDialog(contents); |
115 } | 116 } |
116 } | 117 } |
117 | 118 |
118 void HungRendererDialog::ShowDialog(TabContents* contents) { | 119 void HungRendererDialog::ShowDialog(TabContents* contents) { |
119 DCHECK(contents); | 120 DCHECK(contents); |
120 contents_ = contents; | 121 contents_ = contents; |
121 Browser* browser = BrowserList::GetLastActive(); | 122 Browser* browser = BrowserList::GetLastActive(); |
122 DCHECK(browser); | 123 DCHECK(browser); |
123 handler_ = new HungRendererDialogHandler(contents_); | 124 handler_ = new HungRendererDialogHandler(contents_); |
124 window_ = browser->BrowserShowHtmlDialog(this, NULL); | 125 window_ = browser->BrowserShowHtmlDialog(this, NULL, STYLE_GENERIC); |
125 contents_observer_.reset(new TabContentsObserverImpl(this, contents_)); | 126 contents_observer_.reset(new TabContentsObserverImpl(this, contents_)); |
126 } | 127 } |
127 | 128 |
128 void HungRendererDialog::HideDialog(TabContents* contents) { | 129 void HungRendererDialog::HideDialog(TabContents* contents) { |
129 DCHECK(contents); | 130 DCHECK(contents); |
130 // Don't close the dialog if it's a TabContents for some other renderer. | 131 // Don't close the dialog if it's a TabContents for some other renderer. |
131 if (contents_ && contents_->GetRenderProcessHost() != | 132 if (contents_ && contents_->GetRenderProcessHost() != |
132 contents->GetRenderProcessHost()) | 133 contents->GetRenderProcessHost()) |
133 return; | 134 return; |
134 // Settings |contents_| to NULL prevents the hang monitor from restarting. | 135 // Settings |contents_| to NULL prevents the hang monitor from restarting. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 DictionaryValue* dict = new DictionaryValue(); | 234 DictionaryValue* dict = new DictionaryValue(); |
234 dict->SetString("url", it->tab_contents()->GetURL().spec()); | 235 dict->SetString("url", it->tab_contents()->GetURL().spec()); |
235 dict->SetString("title", title); | 236 dict->SetString("title", title); |
236 tab_contents_list.Append(dict); | 237 tab_contents_list.Append(dict); |
237 } | 238 } |
238 } | 239 } |
239 // Send list of tab contents details to javascript. | 240 // Send list of tab contents details to javascript. |
240 web_ui_->CallJavascriptFunction("hungRendererDialog.setTabContentsList", | 241 web_ui_->CallJavascriptFunction("hungRendererDialog.setTabContentsList", |
241 tab_contents_list); | 242 tab_contents_list); |
242 } | 243 } |
OLD | NEW |