diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser.scons | 9 | ||||
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 12 | ||||
-rw-r--r-- | chrome/browser/tab_contents/ipc_status_view.cc | 371 | ||||
-rw-r--r-- | chrome/browser/tab_contents/ipc_status_view.h | 89 | ||||
-rw-r--r-- | chrome/browser/tab_contents/status_view.cc | 74 | ||||
-rw-r--r-- | chrome/browser/tab_contents/status_view.h | 84 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_factory.cc | 6 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_type.h | 1 | ||||
-rw-r--r-- | chrome/browser/views/SConscript | 8 | ||||
-rw-r--r-- | chrome/browser/views/about_ipc_dialog.cc | 432 | ||||
-rw-r--r-- | chrome/browser/views/about_ipc_dialog.h | 78 | ||||
-rw-r--r-- | chrome/browser/views/about_network_dialog.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/about_network_dialog.h | 1 | ||||
-rw-r--r-- | chrome/browser/views/browser_views.vcproj | 8 |
14 files changed, 645 insertions, 532 deletions
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons index 2692a36..9d5cc5c 100644 --- a/chrome/browser/browser.scons +++ b/chrome/browser/browser.scons @@ -558,12 +558,16 @@ input_files = ChromeFileList([ 'tab_contents/infobar_delegate.h', 'tab_contents/interstitial_page.cc', 'tab_contents/interstitial_page.h', + 'tab_contents/ipc_status_view.cc', + 'tab_contents/ipc_status_view.h', 'tab_contents/native_ui_contents.cc', 'tab_contents/native_ui_contents.h', 'tab_contents/navigation_controller.cc', 'tab_contents/navigation_controller.h', 'tab_contents/navigation_entry.cc', 'tab_contents/navigation_entry.h', + 'tab_contents/network_status_view.cc', + 'tab_contents/network_status_view.h', 'tab_contents/page_navigator.h', 'tab_contents/provisional_load_details.cc', 'tab_contents/provisional_load_details.h', @@ -576,6 +580,8 @@ input_files = ChromeFileList([ 'tab_contents/security_style.h', 'tab_contents/site_instance.cc', 'tab_contents/site_instance.h', + 'tab_contents/status_view.cc', + 'tab_contents/status_view.h', 'tab_contents/tab_contents.cc', 'tab_contents/tab_contents.h', 'tab_contents/tab_contents_delegate.h', @@ -775,13 +781,16 @@ if not env.Bit('windows'): 'ssl/ssl_policy.cc', 'tab_contents/infobar_delegate.cc', 'tab_contents/interstitial_page.cc', + 'tab_contents/ipc_status_view.cc', 'tab_contents/native_ui_contents.cc', 'tab_contents/navigation_controller.cc', 'tab_contents/navigation_entry.cc', + 'tab_contents/network_status_view.cc', 'tab_contents/render_view_context_menu.cc', 'tab_contents/render_view_context_menu_controller.cc', 'tab_contents/render_view_host_manager.cc', 'tab_contents/site_instance.cc', + 'tab_contents/status_view.cc', 'tab_contents/tab_contents.cc', 'tab_contents/tab_contents_factory.cc', 'tab_contents/tab_util.cc', diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 457b5a8..91df8c4 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -29,7 +29,7 @@ #include "chrome/browser/profile_manager.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/views/about_ipc_dialog.h" +#include "chrome/browser/tab_contents/ipc_status_view.h" #include "chrome/browser/views/about_network_dialog.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/l10n_util.h" @@ -185,11 +185,11 @@ bool BrowserAboutHandler::MaybeHandle(GURL* url, } #ifdef IPC_MESSAGE_LOG_ENABLED - if (LowerCaseEqualsASCII(url->path(), "ipc")) { - // Run the dialog. This will re-use the existing one if it's already up. - AboutIPCDialog::RunDialog(); - *url = GURL("about:blank"); - return false; + if ((LowerCaseEqualsASCII(url->path(), "ipc")) && + (IPCStatusView::current() == NULL)) { + // about:ipc doesn't have an internal protocol, so don't modify |url|. + *result_type = TAB_CONTENTS_IPC_STATUS_VIEW; + return true; } #endif diff --git a/chrome/browser/tab_contents/ipc_status_view.cc b/chrome/browser/tab_contents/ipc_status_view.cc new file mode 100644 index 0000000..cd85ee0 --- /dev/null +++ b/chrome/browser/tab_contents/ipc_status_view.cc @@ -0,0 +1,371 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/tab_contents/ipc_status_view.h" + +#include <stdio.h> + +#include "base/logging.h" +#include "base/string_util.h" +#include "chrome/app/chrome_dll_resource.h" +#include "chrome/browser/profile.h" +#include "chrome/common/chrome_constants.h" +#include "chrome/common/ipc_logging.h" +#include "chrome/common/plugin_messages.h" +#include "chrome/common/pref_names.h" +#include "chrome/common/pref_service.h" +#include "chrome/common/render_messages.h" + +#ifdef IPC_MESSAGE_LOG_ENABLED + +using base::Time; + +namespace { +const wchar_t kTitleMsg[] = L"IPC Messages"; + +const wchar_t kStartLoggingMsg[] = L"Start IPC Logging"; +const wchar_t kStopLoggingMsg[] = L"Stop IPC Logging"; +const wchar_t kClearMsg[] = L"Clear"; +const wchar_t kSettingsMsg[] = L"Filter"; + +enum { + kTimeColumn = 0, + kChannelColumn, + kMessageColumn, + kFlagsColumn, + kDispatchColumn, + kProcessColumn, + kParamsColumn, +}; + +// This class ensures that we have a link dependency on render_messages.cc and +// plugin_messages.cc, and at the same time sets up the message logger function +// mappings. +class RegisterLoggerFuncs { + public: + RegisterLoggerFuncs() { + RenderMessagesInit(); + PluginMessagesInit(); + } +}; + +RegisterLoggerFuncs g_register_logger_funcs; + +} // namespace + +IPCStatusView* IPCStatusView::current_; + +IPCStatusView::IPCStatusView() + : StatusView(TAB_CONTENTS_IPC_STATUS_VIEW) { + DCHECK(!current_); + current_ = this; + settings_dialog_ = NULL; + init_done_ = false; + view_ = NULL; + view_host_ = NULL; + plugin_ = NULL; + plugin_host_ = NULL; + npobject_ = NULL; + plugin_process_ = NULL; + plugin_process_host_ = NULL; + + IPC::Logging::current()->SetConsumer(this); +} + +IPCStatusView::~IPCStatusView() { + current_ = NULL; + IPC::Logging::current()->SetConsumer(NULL); + + if (settings_dialog_ != NULL) + ::DestroyWindow(settings_dialog_); +} + +const std::wstring IPCStatusView::GetDefaultTitle() { + return kTitleMsg; +} + +void IPCStatusView::SetActive(bool active) { + StatusView::set_is_active(active); + + if (!disabled_messages_.empty() || !active) + return; + + Profile* current_profile = profile(); + if (!current_profile) + return; + PrefService* prefs = current_profile->GetPrefs(); + if (prefs->IsPrefRegistered(prefs::kIpcDisabledMessages)) + return; + prefs->RegisterListPref(prefs::kIpcDisabledMessages); + const ListValue* list = prefs->GetList(prefs::kIpcDisabledMessages); + if (!list) + return; + for (ListValue::const_iterator itr = list->begin(); + itr != list->end(); + ++itr) { + if (!(*itr)->IsType(Value::TYPE_INTEGER)) + continue; + int value = 0; + if (!(*itr)->GetAsInteger(&value)) + continue; + disabled_messages_.insert(value); + } +} + +void IPCStatusView::OnCreate(const CRect& rect) { + CreateButton(IDC_START_LOGGING, kStartLoggingMsg); + CreateButton(IDC_STOP_LOGGING, kStopLoggingMsg); + CreateButton(IDC_CLEAR, kClearMsg); + CreateButton(IDC_SETTINGS, kSettingsMsg); + + // Initialize the list view for messages. + // Don't worry about the size, we'll resize when we get WM_SIZE + message_list_.Create(GetContainerHWND(), const_cast<CRect&>(rect), NULL, + WS_CHILD | WS_VISIBLE | LVS_SORTASCENDING); + message_list_.SetViewType(LVS_REPORT); + message_list_.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT); + + int column_index = 0; + message_list_.InsertColumn(kTimeColumn, L"time", LVCFMT_LEFT, 80); + message_list_.InsertColumn(kChannelColumn, L"channel", LVCFMT_LEFT, 110); + message_list_.InsertColumn(kMessageColumn, L"message", LVCFMT_LEFT, 240); + message_list_.InsertColumn(kFlagsColumn, L"flags", LVCFMT_LEFT, 50); + message_list_.InsertColumn(kDispatchColumn, L"dispatch (ms)", LVCFMT_RIGHT, 80); + message_list_.InsertColumn(kProcessColumn, L"process (ms)", LVCFMT_RIGHT, 80); + message_list_.InsertColumn(kParamsColumn, L"parameters", LVCFMT_LEFT, 500); +} + +void IPCStatusView::Log(const IPC::LogData& data) { + if (disabled_messages_.find(data.type) != disabled_messages_.end()) + return; // Message type is filtered out. + + Time sent = Time::FromInternalValue(data.sent); + Time::Exploded exploded; + sent.LocalExplode(&exploded); + if (exploded.hour > 12) + exploded.hour -= 12; + + std::wstring sent_str = StringPrintf(L"%02d:%02d:%02d.%03d", + exploded.hour, exploded.minute, exploded.second, exploded.millisecond); + + int count = message_list_.GetItemCount(); + int index = message_list_.InsertItem(count, sent_str.c_str()); + + message_list_.SetItemText(index, kTimeColumn, sent_str.c_str()); + message_list_.SetItemText(index, kChannelColumn, data.channel.c_str()); + + std::wstring message_name; + IPC::Logging::GetMessageText(data.type, &message_name, NULL, NULL); + message_list_.SetItemText(index, kMessageColumn, message_name.c_str()); + message_list_.SetItemText(index, kFlagsColumn, data.flags.c_str()); + + int64 time_to_send = (Time::FromInternalValue(data.receive) - + sent).InMilliseconds(); + // time can go backwards by a few ms (see Time), don't show that. + time_to_send = std::max(static_cast<int>(time_to_send), 0); + std::wstring temp = StringPrintf(L"%d", time_to_send); + message_list_.SetItemText(index, kDispatchColumn, temp.c_str()); + + int64 time_to_process = (Time::FromInternalValue(data.dispatch) - + Time::FromInternalValue(data.receive)).InMilliseconds(); + time_to_process = std::max(static_cast<int>(time_to_process), 0); + temp = StringPrintf(L"%d", time_to_process); + message_list_.SetItemText(index, kProcessColumn, temp.c_str()); + + message_list_.SetItemText(index, kParamsColumn, data.params.c_str()); + message_list_.EnsureVisible(index, FALSE); +} + +void IPCStatusView::OnSize(const CRect& rect) { + message_list_.MoveWindow(rect); +} + +void IPCStatusView::OnStartLogging(UINT code, int button_id, HWND hwnd) { + IPC::Logging::current()->Enable(); +} + +void IPCStatusView::OnStopLogging(UINT code, int button_id, HWND hwnd) { + IPC::Logging::current()->Disable(); +} + +void IPCStatusView::OnClear(UINT code, int button_id, HWND hwnd) { + message_list_.DeleteAllItems(); +} + +INT_PTR CALLBACK IPCStatusView::DialogProc( + HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { + switch (msg) { + case WM_INITDIALOG: + current()->InitDialog(hwnd); + return FALSE; // Don't set keyboard focus. + case WM_SYSCOMMAND: + if (wparam == SC_CLOSE) { + current()->CloseDialog(); + return FALSE; + } + break; + case WM_NOTIFY: { + NMLISTVIEW* info = reinterpret_cast<NM_LISTVIEW*>(lparam); + if ((wparam == IDC_View || wparam == IDC_ViewHost || wparam == IDC_Plugin || + wparam == IDC_PluginHost || wparam == IDC_NPObject || + wparam == IDC_PluginProcess || wparam == IDC_PluginProcessHost) && + info->hdr.code == LVN_ITEMCHANGED) { + if (info->uChanged & LVIF_STATE) { + bool checked = (info->uNewState >> 12) == 2; + current()->OnCheck(static_cast<int>(info->lParam), checked); + } + return FALSE; + } + break; + } + case WM_COMMAND: + if (HIWORD(wparam) == BN_CLICKED) + current()->OnButtonClick(LOWORD(wparam)); + + break; + } + return FALSE; +} + +void IPCStatusView::InitDialog(HWND hwnd) { + CreateColumn(ViewStart, ViewEnd, ::GetDlgItem(hwnd, IDC_View), &view_); + CreateColumn(ViewHostStart, ViewHostEnd, ::GetDlgItem(hwnd, IDC_ViewHost), + &view_host_); + CreateColumn(PluginStart, PluginEnd, ::GetDlgItem(hwnd, IDC_Plugin), &plugin_); + CreateColumn(PluginHostStart, PluginHostEnd, + ::GetDlgItem(hwnd, IDC_PluginHost), &plugin_host_); + CreateColumn(NPObjectStart, NPObjectEnd, ::GetDlgItem(hwnd, IDC_NPObject), + &npobject_); + CreateColumn(PluginProcessStart, PluginProcessEnd, + ::GetDlgItem(hwnd, IDC_PluginProcess), &plugin_process_); + CreateColumn(PluginProcessHostStart, PluginProcessHostEnd, + ::GetDlgItem(hwnd, IDC_PluginProcessHost), &plugin_process_host_); + init_done_ = true; +} + +void IPCStatusView::CreateColumn( + uint16 start, uint16 end, HWND hwnd, CListViewCtrl** control) { + DCHECK(*control == NULL); + *control = new CListViewCtrl(hwnd); + CListViewCtrl* control_ptr = *control; + control_ptr->SetViewType(LVS_REPORT); + control_ptr->SetExtendedListViewStyle(LVS_EX_CHECKBOXES); + control_ptr->ModifyStyle(0, LVS_SORTASCENDING | LVS_NOCOLUMNHEADER); + control_ptr->InsertColumn(0, L"id", LVCFMT_LEFT, 230); + + std::set<int>* disabled_messages = ¤t()->disabled_messages_; + for (uint16 i = start; i < end; i++) { + std::wstring name; + IPC::Logging::GetMessageText(i, &name, NULL, NULL); + + int index = control_ptr->InsertItem( + LVIF_TEXT | LVIF_PARAM, 0, name.c_str(), 0, 0, 0, i); + + control_ptr->SetItemText(index, 0, name.c_str()); + + if (disabled_messages->find(i) == disabled_messages->end()) + control_ptr->SetCheckState(index, TRUE); + } +} + +void IPCStatusView::CloseDialog() { + delete view_; + delete view_host_; + delete plugin_host_; + delete npobject_; + delete plugin_process_; + delete plugin_process_host_; + view_ = NULL; + view_host_ = NULL; + plugin_ = NULL; + plugin_host_ = NULL; + npobject_ = NULL; + plugin_process_ = NULL; + plugin_process_host_ = NULL; + init_done_ = false; + + ::DestroyWindow(settings_dialog_); + settings_dialog_ = NULL; + + Profile* current_profile = profile(); + if (!current_profile) + return; + PrefService* prefs = current_profile->GetPrefs(); + if (!prefs->IsPrefRegistered(prefs::kIpcDisabledMessages)) + return; + ListValue* list = prefs->GetMutableList(prefs::kIpcDisabledMessages); + list->Clear(); + for (std::set<int>::const_iterator itr = disabled_messages_.begin(); + itr != disabled_messages_.end(); + ++itr) { + list->Append(Value::CreateIntegerValue(*itr)); + } +} + +void IPCStatusView::OnCheck(int id, bool checked) { + if (!init_done_) + return; + + if (checked) { + disabled_messages_.erase(id); + } else { + disabled_messages_.insert(id); + } +} + +void IPCStatusView::OnButtonClick(int id) { + switch(id) { + case IDC_ViewAll: + CheckButtons(view_, true); + break; + case IDC_ViewNone: + CheckButtons(view_, false); + break; + case IDC_ViewHostAll: + CheckButtons(view_host_, true); + break; + case IDC_ViewHostNone: + CheckButtons(view_host_, false); + break; + case IDC_PluginAll: + CheckButtons(plugin_, true); + break; + case IDC_PluginNone: + CheckButtons(plugin_, false); + break; + case IDC_PluginHostAll: + CheckButtons(plugin_host_, true); + break; + case IDC_PluginHostNone: + CheckButtons(plugin_host_, false); + break; + case IDC_NPObjectAll: + CheckButtons(npobject_, true); + break; + case IDC_NPObjectNone: + CheckButtons(npobject_, false); + break; + } +} + +void IPCStatusView::CheckButtons(CListViewCtrl* control, bool check) { + int count = control->GetItemCount(); + for (int i = 0; i < count; ++i) + control->SetCheckState(i, check); +} + +void IPCStatusView::OnSettings(UINT code, int button_id, HWND hwnd) { + if (settings_dialog_ != NULL) + return; + + HINSTANCE module_handle = GetModuleHandle(chrome::kBrowserResourcesDll); + + settings_dialog_ = CreateDialog(module_handle, + MAKEINTRESOURCE(IDD_IPC_SETTINGS), + NULL, + IPCStatusView::DialogProc); + ::ShowWindow(settings_dialog_, SW_SHOW); +} + +#endif // IPC_MESSAGE_LOG_ENABLED diff --git a/chrome/browser/tab_contents/ipc_status_view.h b/chrome/browser/tab_contents/ipc_status_view.h new file mode 100644 index 0000000..d0f28b1 --- /dev/null +++ b/chrome/browser/tab_contents/ipc_status_view.h @@ -0,0 +1,89 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_TAB_CONTENTS_IPC_STATUS_VIEW_H_ +#define CHROME_BROWSER_TAB_CONTENTS_IPC_STATUS_VIEW_H_ + +#include <set> + +#include "base/basictypes.h" +#include "chrome/browser/tab_contents/status_view.h" +#include "chrome/common/ipc_logging.h" +#include "chrome/common/ipc_message_utils.h" + +#ifdef IPC_MESSAGE_LOG_ENABLED + +class IPCStatusView : public StatusView, + public IPC::Logging::Consumer { + public: + // button types + enum { + IDC_START_LOGGING = 101, + IDC_STOP_LOGGING, + IDC_CLEAR, + IDC_SETTINGS, + }; + + IPCStatusView(); + virtual ~IPCStatusView(); + + static IPCStatusView* current() { return current_; } + void Log(const IPC::LogData& data); + + // TabContents overrides + virtual const std::wstring GetDefaultTitle(); + virtual void SetActive(bool active); + + // StatusView implementation + virtual void OnCreate(const CRect& rect); + virtual void OnSize(const CRect& rect); + + BEGIN_MSG_MAP(IPCStatusView) + COMMAND_HANDLER_EX(IDC_START_LOGGING, BN_CLICKED, OnStartLogging) + COMMAND_HANDLER_EX(IDC_STOP_LOGGING, BN_CLICKED, OnStopLogging) + COMMAND_HANDLER_EX(IDC_CLEAR, BN_CLICKED, OnClear) + COMMAND_HANDLER_EX(IDC_SETTINGS, BN_CLICKED, OnSettings) + CHAIN_MSG_MAP(StatusView); + END_MSG_MAP() + + static INT_PTR CALLBACK DialogProc( + HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); + void InitDialog(HWND hwnd); + void CloseDialog(); + static void CreateColumn( + uint16 start, uint16 end, HWND hwnd, CListViewCtrl** control); + void OnCheck(int id, bool checked); + void OnButtonClick(int id); + static void CheckButtons(CListViewCtrl* control, bool check); + + private: + + // Event handlers + void OnStartLogging(UINT code, int button_id, HWND hwnd); + void OnStopLogging(UINT code, int button_id, HWND hwnd); + void OnClear(UINT code, int button_id, HWND hwnd); + void OnSettings(UINT code, int button_id, HWND hwnd); + + static IPCStatusView* current_; + CListViewCtrl message_list_; + + // Used for the filter dialog. + CListViewCtrl* view_; + CListViewCtrl* view_host_; + CListViewCtrl* plugin_; + CListViewCtrl* plugin_host_; + CListViewCtrl* npobject_; + CListViewCtrl* plugin_process_; + CListViewCtrl* plugin_process_host_; + bool init_done_; + HWND settings_dialog_; + std::set<int> disabled_messages_; + + DISALLOW_COPY_AND_ASSIGN(IPCStatusView); +}; + +#endif // IPC_MESSAGE_LOG_ENABLED + +#endif // #ifndef CHROME_BROWSER_TAB_CONTENTS_IPC_STATUS_VIEW_H_ + diff --git a/chrome/browser/tab_contents/status_view.cc b/chrome/browser/tab_contents/status_view.cc new file mode 100644 index 0000000..349ac53 --- /dev/null +++ b/chrome/browser/tab_contents/status_view.cc @@ -0,0 +1,74 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/tab_contents/status_view.h" + +const int StatusView::kLayoutPadding = 5; +const int StatusView::kButtonWidth = 200; +const int StatusView::kButtonHeight = 30; + +StatusView::StatusView(TabContentsType type) : TabContents(type) { +} + +StatusView::~StatusView() { + for (size_t i = 0; i < buttons_.size(); ++i) + delete buttons_[i].button; +} + +void StatusView::CreateView() { + Create(GetDesktopWindow()); +} + +LRESULT StatusView::OnCreate(LPCREATESTRUCT create_struct) { + CRect rect(kLayoutPadding, kButtonHeight + kLayoutPadding * 2, 200, 200); + OnCreate(rect); + return 0; +} + +void StatusView::OnSize(WPARAM wParam, const CSize& size) { + int start_x = kLayoutPadding; + int start_y = kButtonHeight + kLayoutPadding * 2; + int end_x = size.cx - kLayoutPadding; + int end_y = size.cy - kLayoutPadding; + CRect rect(start_x, start_y, end_x, end_y); + OnSize(rect); +} + +LRESULT StatusView::OnEraseBkgnd(HDC hdc) { + HBRUSH brush = GetSysColorBrush(COLOR_3DFACE); + HGDIOBJ old_brush = SelectObject(hdc, brush); + + RECT rc; + GetClientRect(&rc); + FillRect(hdc, &rc, brush); + + SelectObject(hdc, old_brush); + return 1; +} + +void StatusView::CreateButton(int id, const wchar_t* title) { + int button_count = static_cast<int>(buttons_.size()); + int width_offset = + kLayoutPadding + button_count * (kButtonWidth + kLayoutPadding); + CRect rect(0, 0, kButtonWidth, kButtonHeight); + rect.OffsetRect(width_offset, kLayoutPadding); + ButtonInfo bi; + bi.button = new CButton(); + bi.id = id; + bi.button->Create(m_hWnd, rect, NULL, WS_CHILD | WS_VISIBLE, 0, bi.id); + bi.button->SetWindowText(title); + buttons_.push_back(bi); +} + +void StatusView::SetButtonText(int id, const wchar_t* title) { + for (size_t i = 0; i < buttons_.size(); ++i) { + if (buttons_[i].id == id) { + buttons_[i].button->SetWindowText(title); + return; + } + } + + DLOG(INFO) << "No button with id " << id << " to set title " << title; +} + diff --git a/chrome/browser/tab_contents/status_view.h b/chrome/browser/tab_contents/status_view.h new file mode 100644 index 0000000..88d1b91 --- /dev/null +++ b/chrome/browser/tab_contents/status_view.h @@ -0,0 +1,84 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_TAB_CONTENTS_STATUS_VIEW_H_ +#define CHROME_BROWSER_TAB_CONTENTS_STATUS_VIEW_H_ + +#include <atlbase.h> +#include <atlapp.h> +#include <atlcrack.h> +#include <atlctrls.h> +#include <atlmisc.h> +#include <vector> + +#include "base/basictypes.h" +#include "chrome/browser/tab_contents/tab_contents.h" + +typedef CWinTraits<WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS> + StatusViewTraits; + +// A base class for about:network, about:ipc etc. It handles creating a row of +// buttons at the top of the page. Derived classes get a rect of the remaining +// area and can create their own controls there. +class StatusView : public TabContents, + public CWindowImpl<StatusView, CWindow, StatusViewTraits> { + public: + StatusView(TabContentsType type); + + BEGIN_MSG_MAP(StatusView) + MSG_WM_CREATE(OnCreate) + MSG_WM_ERASEBKGND(OnEraseBkgnd) + MSG_WM_SIZE(OnSize) + END_MSG_MAP() + + virtual void CreateView(); + virtual HWND GetContainerHWND() const { return m_hWnd; } + + // Derived classes should implement the following functions + // TabContents override, to set the page title. + // virtual const std::wstring GetDefaultTitle() = 0; + // Gives a rect whose top left corner is after the buttons. The size of the + // controls that are added by derived classes will be set in the next OnSize, + // for now can use any height/width. + virtual void OnCreate(const CRect& rect) = 0; + virtual void OnSize(const CRect& rect) = 0; + + protected: + // Should be deleted via CloseContents. + virtual ~StatusView(); + + // Creates and adds a button to the top row of the page. Button ids should + // be unique and start at 101. + void CreateButton(int id, const wchar_t* title); + void SetButtonText(int id, const wchar_t* title); + + static const int kLayoutPadding; + static const int kButtonWidth; + static const int kButtonHeight; + + private: + // FocusTraversal Implementation + // TODO (jcampan): make focus traversal work + views::View* FindNextFocusableView(views::View* starting_view, bool reverse, + bool dont_loop) { + return NULL; + } + + // Event handlers + LRESULT OnCreate(LPCREATESTRUCT create_struct); + void OnSize(UINT size_command, const CSize& new_size); + LRESULT OnEraseBkgnd(HDC hdc); + + struct ButtonInfo { + CButton* button; + int id; + }; + + std::vector<ButtonInfo> buttons_; + + DISALLOW_EVIL_CONSTRUCTORS(StatusView); +}; + +#endif // #ifndef CHROME_BROWSER_TAB_CONTENTS_STATUS_VIEW_H_ + diff --git a/chrome/browser/tab_contents/tab_contents_factory.cc b/chrome/browser/tab_contents/tab_contents_factory.cc index 18f3569..2367592 100644 --- a/chrome/browser/tab_contents/tab_contents_factory.cc +++ b/chrome/browser/tab_contents/tab_contents_factory.cc @@ -11,6 +11,7 @@ #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/debugger/debugger_contents.h" +#include "chrome/browser/tab_contents/ipc_status_view.h" #include "chrome/browser/tab_contents/native_ui_contents.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_factory.h" @@ -43,6 +44,11 @@ TabContents* TabContents::CreateWithType(TabContentsType type, case TAB_CONTENTS_WEB: contents = new WebContents(profile, instance, NULL, MSG_ROUTING_NONE, NULL); break; +#ifdef IPC_MESSAGE_LOG_ENABLED + case TAB_CONTENTS_IPC_STATUS_VIEW: + contents = new IPCStatusView(); + break; +#endif case TAB_CONTENTS_NEW_TAB_UI: contents = new NewTabUIContents(profile, instance, NULL); break; diff --git a/chrome/browser/tab_contents/tab_contents_type.h b/chrome/browser/tab_contents/tab_contents_type.h index 87cd6452..73fc81f 100644 --- a/chrome/browser/tab_contents/tab_contents_type.h +++ b/chrome/browser/tab_contents/tab_contents_type.h @@ -13,6 +13,7 @@ enum TabContentsType { TAB_CONTENTS_UNKNOWN_TYPE = 0, TAB_CONTENTS_WEB, TAB_CONTENTS_DOWNLOAD_VIEW, + TAB_CONTENTS_IPC_STATUS_VIEW, TAB_CONTENTS_CHROME_VIEW_CONTENTS, TAB_CONTENTS_NEW_TAB_UI, TAB_CONTENTS_NATIVE_UI, diff --git a/chrome/browser/views/SConscript b/chrome/browser/views/SConscript index 6af89a0..55f599f 100644 --- a/chrome/browser/views/SConscript +++ b/chrome/browser/views/SConscript @@ -125,10 +125,6 @@ input_files = ChromeFileList([ ]), 'about_chrome_view.cc', 'about_chrome_view.h', - 'about_ipc_dialog.cc', - 'about_ipc_dialog.h', - 'about_network_dialog.cc', - 'about_network_dialog.h', 'blocked_popup_container.cc', 'blocked_popup_container.h', 'bookmark_bar_view.cc', @@ -237,8 +233,6 @@ if env.Bit('linux'): # TODO(port): Port to Linux. input_files.Remove( 'about_chrome_view.cc', - 'about_ipc_dialog.cc', - 'about_network_dialog.cc', 'blocked_popup_container.cc', 'bookmark_bar_view.cc', 'bookmark_bubble_view.cc', @@ -320,8 +314,6 @@ if env.Bit('mac'): # TODO(port): Port to Mac. input_files.Remove( 'about_chrome_view.cc', - 'about_ipc_dialog.cc' - 'about_network_dialog.cc' 'blocked_popup_container.cc', 'bookmark_bar_view.cc', 'bookmark_bubble_view.cc', diff --git a/chrome/browser/views/about_ipc_dialog.cc b/chrome/browser/views/about_ipc_dialog.cc deleted file mode 100644 index 28f45c9..0000000 --- a/chrome/browser/views/about_ipc_dialog.cc +++ /dev/null @@ -1,432 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/views/about_ipc_dialog.h" - -#include <set> - -#include "base/string_util.h" -#include "base/thread.h" -#include "base/time.h" -#include "chrome/app/chrome_dll_resource.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/views/standard_layout.h" -#include "chrome/common/chrome_constants.h" -#include "chrome/common/plugin_messages.h" -#include "chrome/common/render_messages.h" -#include "chrome/views/grid_layout.h" -#include "chrome/views/text_button.h" -#include "chrome/views/window.h" -#include "net/url_request/url_request.h" -#include "net/url_request/url_request_job.h" -#include "net/url_request/url_request_job_tracker.h" -#include "chrome/views/hwnd_view.h" -#include "chrome/views/root_view.h" - - -namespace { - -// We don't localize this UI since this is a developer-only feature. -const wchar_t kStartTrackingLabel[] = L"Start tracking"; -const wchar_t kStopTrackingLabel[] = L"Stop tracking"; -const wchar_t kClearLabel[] = L"Clear"; -const wchar_t kFilterLabel[] = L"Filter..."; - -enum { - kTimeColumn = 0, - kChannelColumn, - kMessageColumn, - kFlagsColumn, - kDispatchColumn, - kProcessColumn, - kParamsColumn, -}; - -// This class ensures that we have a link dependency on render_messages.cc and -// plugin_messages.cc, and at the same time sets up the message logger function -// mappings. -class RegisterLoggerFuncs { - public: - RegisterLoggerFuncs() { - RenderMessagesInit(); - PluginMessagesInit(); - } -}; - -RegisterLoggerFuncs g_register_logger_funcs; - -// The singleton dialog box. This is non-NULL when a dialog is active so we -// know not to create a new one. -AboutIPCDialog* active_dialog = NULL; - -std::set<int> disabled_messages; - -// Settings dialog ------------------------------------------------------------- - -bool init_done = false; -HWND settings_dialog = NULL; - -// Settings lists. -struct Settings { - CListViewCtrl* view; - CListViewCtrl* view_host; - CListViewCtrl* plugin; - CListViewCtrl* plugin_host; - CListViewCtrl* npobject; - CListViewCtrl* plugin_process; - CListViewCtrl* plugin_process_host; -} settings_views = { NULL, NULL, NULL, NULL, NULL, NULL, NULL }; - -void CreateColumn(uint16 start, uint16 end, HWND hwnd, - CListViewCtrl** control) { - DCHECK(*control == NULL); - *control = new CListViewCtrl(hwnd); - CListViewCtrl* control_ptr = *control; - control_ptr->SetViewType(LVS_REPORT); - control_ptr->SetExtendedListViewStyle(LVS_EX_CHECKBOXES); - control_ptr->ModifyStyle(0, LVS_SORTASCENDING | LVS_NOCOLUMNHEADER); - control_ptr->InsertColumn(0, L"id", LVCFMT_LEFT, 230); - - for (uint16 i = start; i < end; i++) { - std::wstring name; - IPC::Logging::GetMessageText(i, &name, NULL, NULL); - - int index = control_ptr->InsertItem( - LVIF_TEXT | LVIF_PARAM, 0, name.c_str(), 0, 0, 0, i); - - control_ptr->SetItemText(index, 0, name.c_str()); - - if (disabled_messages.find(i) == disabled_messages.end()) - control_ptr->SetCheckState(index, TRUE); - } -} - -void OnCheck(int id, bool checked) { - if (!init_done) - return; - - if (checked) - disabled_messages.erase(id); - else - disabled_messages.insert(id); -} - - -void CheckButtons(CListViewCtrl* control, bool check) { - int count = control->GetItemCount(); - for (int i = 0; i < count; ++i) - control->SetCheckState(i, check); -} - -void InitDialog(HWND hwnd) { - CreateColumn(ViewStart, ViewEnd, ::GetDlgItem(hwnd, IDC_View), - &settings_views.view); - CreateColumn(ViewHostStart, ViewHostEnd, ::GetDlgItem(hwnd, IDC_ViewHost), - &settings_views.view_host); - CreateColumn(PluginStart, PluginEnd, ::GetDlgItem(hwnd, IDC_Plugin), - &settings_views.plugin); - CreateColumn(PluginHostStart, PluginHostEnd, - ::GetDlgItem(hwnd, IDC_PluginHost), - &settings_views.plugin_host); - CreateColumn(NPObjectStart, NPObjectEnd, ::GetDlgItem(hwnd, IDC_NPObject), - &settings_views.npobject); - CreateColumn(PluginProcessStart, PluginProcessEnd, - ::GetDlgItem(hwnd, IDC_PluginProcess), - &settings_views.plugin_process); - CreateColumn(PluginProcessHostStart, PluginProcessHostEnd, - ::GetDlgItem(hwnd, IDC_PluginProcessHost), - &settings_views.plugin_process_host); - init_done = true; -} - -void CloseDialog() { - delete settings_views.view; - delete settings_views.view_host; - delete settings_views.plugin_host; - delete settings_views.npobject; - delete settings_views.plugin_process; - delete settings_views.plugin_process_host; - settings_views.view = NULL; - settings_views.view_host = NULL; - settings_views.plugin = NULL; - settings_views.plugin_host = NULL; - settings_views.npobject = NULL; - settings_views.plugin_process = NULL; - settings_views.plugin_process_host = NULL; - - init_done = false; - - ::DestroyWindow(settings_dialog); - settings_dialog = NULL; - - /* The old version of this code stored the last settings in the preferences. - But with this dialog, there currently isn't an easy way to get the profile - to asave in the preferences. - Profile* current_profile = profile(); - if (!current_profile) - return; - PrefService* prefs = current_profile->GetPrefs(); - if (!prefs->IsPrefRegistered(prefs::kIpcDisabledMessages)) - return; - ListValue* list = prefs->GetMutableList(prefs::kIpcDisabledMessages); - list->Clear(); - for (std::set<int>::const_iterator itr = disabled_messages_.begin(); - itr != disabled_messages_.end(); - ++itr) { - list->Append(Value::CreateIntegerValue(*itr)); - } - */ -} - -void OnButtonClick(int id) { - switch(id) { - case IDC_ViewAll: - CheckButtons(settings_views.view, true); - break; - case IDC_ViewNone: - CheckButtons(settings_views.view, false); - break; - case IDC_ViewHostAll: - CheckButtons(settings_views.view_host, true); - break; - case IDC_ViewHostNone: - CheckButtons(settings_views.view_host, false); - break; - case IDC_PluginAll: - CheckButtons(settings_views.plugin, true); - break; - case IDC_PluginNone: - CheckButtons(settings_views.plugin, false); - break; - case IDC_PluginHostAll: - CheckButtons(settings_views.plugin_host, true); - break; - case IDC_PluginHostNone: - CheckButtons(settings_views.plugin_host, false); - break; - case IDC_NPObjectAll: - CheckButtons(settings_views.npobject, true); - break; - case IDC_NPObjectNone: - CheckButtons(settings_views.npobject, false); - break; - } -} - -INT_PTR CALLBACK DialogProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { - switch (msg) { - case WM_INITDIALOG: - InitDialog(hwnd); - return FALSE; // Don't set keyboard focus. - case WM_SYSCOMMAND: - if (wparam == SC_CLOSE) { - CloseDialog(); - return FALSE; - } - break; - case WM_NOTIFY: { - NMLISTVIEW* info = reinterpret_cast<NM_LISTVIEW*>(lparam); - if ((wparam == IDC_View || wparam == IDC_ViewHost || wparam == IDC_Plugin || - wparam == IDC_PluginHost || wparam == IDC_NPObject || - wparam == IDC_PluginProcess || wparam == IDC_PluginProcessHost) && - info->hdr.code == LVN_ITEMCHANGED) { - if (info->uChanged & LVIF_STATE) { - bool checked = (info->uNewState >> 12) == 2; - OnCheck(static_cast<int>(info->lParam), checked); - } - return FALSE; - } - break; - } - case WM_COMMAND: - if (HIWORD(wparam) == BN_CLICKED) - OnButtonClick(LOWORD(wparam)); - break; - } - return FALSE; -} - -void RunSettingsDialog(HWND parent) { - if (settings_dialog) - return; - HINSTANCE module_handle = GetModuleHandle(chrome::kBrowserResourcesDll); - settings_dialog = CreateDialog(module_handle, - MAKEINTRESOURCE(IDD_IPC_SETTINGS), - NULL, - &DialogProc); - ::ShowWindow(settings_dialog, SW_SHOW); -} - -} // namespace - -// AboutIPCDialog -------------------------------------------------------------- - -AboutIPCDialog::AboutIPCDialog() - : track_toggle_(NULL), - clear_button_(NULL), - filter_button_(NULL), - table_(NULL), - tracking_(false) { - SetupControls(); - IPC::Logging::current()->SetConsumer(this); -} - -AboutIPCDialog::~AboutIPCDialog() { - active_dialog = NULL; - IPC::Logging::current()->SetConsumer(NULL); -} - -// static -void AboutIPCDialog::RunDialog() { - if (!active_dialog) { - active_dialog = new AboutIPCDialog; - views::Window::CreateChromeWindow(NULL, gfx::Rect(), active_dialog)->Show(); - } else { - // TOOD(brettw) it would be nice to focus the existing window. - } -} - -void AboutIPCDialog::SetupControls() { - views::GridLayout* layout = CreatePanelGridLayout(this); - SetLayoutManager(layout); - - track_toggle_ = new views::TextButton(kStartTrackingLabel); - track_toggle_->SetListener(this, 1); - clear_button_ = new views::TextButton(kClearLabel); - clear_button_->SetListener(this, 2); - filter_button_ = new views::TextButton(kFilterLabel); - filter_button_->SetListener(this, 3); - - table_ = new views::HWNDView(); - - static const int first_column_set = 1; - views::ColumnSet* column_set = layout->AddColumnSet(first_column_set); - column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, - 33.33f, views::GridLayout::FIXED, 0, 0); - column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, - 33.33f, views::GridLayout::FIXED, 0, 0); - column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, - 33.33f, views::GridLayout::FIXED, 0, 0); - - static const int table_column_set = 2; - column_set = layout->AddColumnSet(table_column_set); - column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, - 100.0f, views::GridLayout::FIXED, 0, 0); - - layout->StartRow(0, first_column_set); - layout->AddView(track_toggle_); - layout->AddView(clear_button_); - layout->AddView(filter_button_); - layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); - layout->StartRow(1.0f, table_column_set); - layout->AddView(table_); -} - -gfx::Size AboutIPCDialog::GetPreferredSize() { - return gfx::Size(800, 400); -} - -views::View* AboutIPCDialog::GetContentsView() { - return this; -} - -int AboutIPCDialog::GetDialogButtons() const { - // Don't want OK or Cancel. - return 0; -} - -std::wstring AboutIPCDialog::GetWindowTitle() const { - return L"about:ipc"; -} - -void AboutIPCDialog::Layout() { - if (!message_list_.m_hWnd) { - HWND parent_window = GetRootView()->GetWidget()->GetHWND(); - - CRect rect(0, 0, 10, 10); - HWND list_hwnd = message_list_.Create(parent_window, - rect, NULL, WS_CHILD | WS_VISIBLE | LVS_SORTASCENDING); - message_list_.SetViewType(LVS_REPORT); - message_list_.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT); - - int column_index = 0; - message_list_.InsertColumn(kTimeColumn, L"time", LVCFMT_LEFT, 80); - message_list_.InsertColumn(kChannelColumn, L"channel", LVCFMT_LEFT, 110); - message_list_.InsertColumn(kMessageColumn, L"message", LVCFMT_LEFT, 240); - message_list_.InsertColumn(kFlagsColumn, L"flags", LVCFMT_LEFT, 50); - message_list_.InsertColumn(kDispatchColumn, L"dispatch (ms)", LVCFMT_RIGHT, - 80); - message_list_.InsertColumn(kProcessColumn, L"process (ms)", LVCFMT_RIGHT, - 80); - message_list_.InsertColumn(kParamsColumn, L"parameters", LVCFMT_LEFT, 500); - - table_->Attach(list_hwnd); - } - - View::Layout(); -} - -void AboutIPCDialog::Log(const IPC::LogData& data) { - if (disabled_messages.find(data.type) != disabled_messages.end()) - return; // Message type is filtered out. - - base::Time sent = base::Time::FromInternalValue(data.sent); - base::Time::Exploded exploded; - sent.LocalExplode(&exploded); - if (exploded.hour > 12) - exploded.hour -= 12; - - std::wstring sent_str = StringPrintf(L"%02d:%02d:%02d.%03d", - exploded.hour, exploded.minute, exploded.second, exploded.millisecond); - - int count = message_list_.GetItemCount(); - int index = message_list_.InsertItem(count, sent_str.c_str()); - - message_list_.SetItemText(index, kTimeColumn, sent_str.c_str()); - message_list_.SetItemText(index, kChannelColumn, data.channel.c_str()); - - std::wstring message_name; - IPC::Logging::GetMessageText(data.type, &message_name, NULL, NULL); - message_list_.SetItemText(index, kMessageColumn, message_name.c_str()); - message_list_.SetItemText(index, kFlagsColumn, data.flags.c_str()); - - int64 time_to_send = (base::Time::FromInternalValue(data.receive) - - sent).InMilliseconds(); - // time can go backwards by a few ms (see Time), don't show that. - time_to_send = std::max(static_cast<int>(time_to_send), 0); - std::wstring temp = StringPrintf(L"%d", time_to_send); - message_list_.SetItemText(index, kDispatchColumn, temp.c_str()); - - int64 time_to_process = (base::Time::FromInternalValue(data.dispatch) - - base::Time::FromInternalValue(data.receive)).InMilliseconds(); - time_to_process = std::max(static_cast<int>(time_to_process), 0); - temp = StringPrintf(L"%d", time_to_process); - message_list_.SetItemText(index, kProcessColumn, temp.c_str()); - - message_list_.SetItemText(index, kParamsColumn, data.params.c_str()); - message_list_.EnsureVisible(index, FALSE); -} - -bool AboutIPCDialog::CanResize() const { - return true; -} - -void AboutIPCDialog::ButtonPressed(views::BaseButton* button) { - if (button == track_toggle_) { - if (tracking_) { - track_toggle_->SetText(kStartTrackingLabel); - tracking_ = false; - IPC::Logging::current()->Disable(); - } else { - track_toggle_->SetText(kStopTrackingLabel); - tracking_ = true; - IPC::Logging::current()->Enable(); - } - track_toggle_->SchedulePaint(); - } else if (button == clear_button_) { - message_list_.DeleteAllItems(); - } else if (button == filter_button_) { - RunSettingsDialog(GetRootView()->GetWidget()->GetHWND()); - } -} diff --git a/chrome/browser/views/about_ipc_dialog.h b/chrome/browser/views/about_ipc_dialog.h deleted file mode 100644 index 969c3c09..0000000 --- a/chrome/browser/views/about_ipc_dialog.h +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_VIEWS_ABOUT_IPC_DIALOG_H_ -#define CHROME_BROWSER_VIEWS_ABOUT_IPC_DIALOG_H_ - -#include <atlbase.h> -#include <atlapp.h> -#include <atlcrack.h> -#include <atlctrls.h> -#include <atlmisc.h> - -#include "base/singleton.h" -#include "chrome/common/ipc_logging.h" -#include "chrome/views/base_button.h" -#include "chrome/views/dialog_delegate.h" -#include "chrome/views/table_view.h" - -#if defined(OS_WIN) - -class Profile; -namespace views { -class TextButton; -class HWNDView; -} // namespace views - -class AboutIPCDialog : public views::DialogDelegate, - public views::BaseButton::ButtonListener, - public IPC::Logging::Consumer, - public views::View { - public: - // This dialog is a singleton. If the dialog is already opened, it won't do - // anything, so you can just blindly call this function all you want. - static void RunDialog(); - - virtual ~AboutIPCDialog(); - - private: - friend struct DefaultSingletonTraits<AboutIPCDialog>; - - AboutIPCDialog(); - - // Sets up all UI controls for the dialog. - void SetupControls(); - - // views::View overrides. - virtual gfx::Size GetPreferredSize(); - virtual views::View* GetContentsView(); - virtual int GetDialogButtons() const; - virtual std::wstring GetWindowTitle() const; - virtual void Layout(); - - // IPC::Logging::Consumer implementation. - virtual void Log(const IPC::LogData& data); - - // views::WindowDelegate (via view::DialogDelegate). - virtual bool CanResize() const; - - // views::BaseButton::ButtonListener. - virtual void ButtonPressed(views::BaseButton* button); - - CListViewCtrl message_list_; - - views::TextButton* track_toggle_; - views::TextButton* clear_button_; - views::TextButton* filter_button_; - views::HWNDView* table_; - - // Set to true when we're tracking network status. - bool tracking_; - - DISALLOW_COPY_AND_ASSIGN(AboutIPCDialog); -}; - -#endif - -#endif // CHROME_BROWSER_VIEWS_ABOUT_IPC_DIALOG_H_ diff --git a/chrome/browser/views/about_network_dialog.cc b/chrome/browser/views/about_network_dialog.cc index 1f25ec8..a1af274 100644 --- a/chrome/browser/views/about_network_dialog.cc +++ b/chrome/browser/views/about_network_dialog.cc @@ -353,6 +353,10 @@ std::wstring AboutNetworkDialog::GetWindowTitle() const { return L"about:network"; } +void AboutNetworkDialog::Layout() { + GetLayoutManager()->Layout(this); +} + bool AboutNetworkDialog::CanResize() const { return true; } diff --git a/chrome/browser/views/about_network_dialog.h b/chrome/browser/views/about_network_dialog.h index e9fe81d..a9dd2cc 100644 --- a/chrome/browser/views/about_network_dialog.h +++ b/chrome/browser/views/about_network_dialog.h @@ -43,6 +43,7 @@ class AboutNetworkDialog : public views::DialogDelegate, virtual views::View* GetContentsView(); virtual int GetDialogButtons() const; virtual std::wstring GetWindowTitle() const; + virtual void Layout(); // views::WindowDelegate (via view::DialogDelegate). virtual bool CanResize() const; diff --git a/chrome/browser/views/browser_views.vcproj b/chrome/browser/views/browser_views.vcproj index 28a31b1..3a85578 100644 --- a/chrome/browser/views/browser_views.vcproj +++ b/chrome/browser/views/browser_views.vcproj @@ -370,14 +370,6 @@ > </File> <File - RelativePath=".\about_ipc_dialog.cc" - > - </File> - <File - RelativePath=".\about_ipc_dialog.h" - > - </File> - <File RelativePath=".\about_network_dialog.cc" > </File> |