| 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 #ifndef CHROME_BROWSER_UI_VIEWS_HUNG_RENDERER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_HUNG_RENDERER_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_HUNG_RENDERER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_HUNG_RENDERER_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "chrome/browser/favicon/favicon_tab_helper.h" | 9 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 void InitForWebContents(content::WebContents* hung_contents); | 41 void InitForWebContents(content::WebContents* hung_contents); |
| 42 | 42 |
| 43 // Returns the first RenderProcessHost, or NULL if there aren't any | 43 // Returns the first RenderProcessHost, or NULL if there aren't any |
| 44 // WebContents. | 44 // WebContents. |
| 45 content::RenderProcessHost* GetRenderProcessHost(); | 45 content::RenderProcessHost* GetRenderProcessHost(); |
| 46 | 46 |
| 47 // Returns the first RenderViewHost, or NULL if there aren't any WebContents. | 47 // Returns the first RenderViewHost, or NULL if there aren't any WebContents. |
| 48 content::RenderViewHost* GetRenderViewHost(); | 48 content::RenderViewHost* GetRenderViewHost(); |
| 49 | 49 |
| 50 // Overridden from ui::TableModel: | 50 // Overridden from ui::TableModel: |
| 51 virtual int RowCount() OVERRIDE; | 51 virtual int RowCount() override; |
| 52 virtual base::string16 GetText(int row, int column_id) OVERRIDE; | 52 virtual base::string16 GetText(int row, int column_id) override; |
| 53 virtual gfx::ImageSkia GetIcon(int row) OVERRIDE; | 53 virtual gfx::ImageSkia GetIcon(int row) override; |
| 54 virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; | 54 virtual void SetObserver(ui::TableModelObserver* observer) override; |
| 55 | 55 |
| 56 // Overridden from views::TableGrouper: | 56 // Overridden from views::TableGrouper: |
| 57 virtual void GetGroupRange(int model_index, | 57 virtual void GetGroupRange(int model_index, |
| 58 views::GroupRange* range) OVERRIDE; | 58 views::GroupRange* range) override; |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 // Used to track a single WebContents. If the WebContents is destroyed | 61 // Used to track a single WebContents. If the WebContents is destroyed |
| 62 // TabDestroyed() is invoked on the model. | 62 // TabDestroyed() is invoked on the model. |
| 63 class WebContentsObserverImpl : public content::WebContentsObserver { | 63 class WebContentsObserverImpl : public content::WebContentsObserver { |
| 64 public: | 64 public: |
| 65 WebContentsObserverImpl(HungPagesTableModel* model, | 65 WebContentsObserverImpl(HungPagesTableModel* model, |
| 66 content::WebContents* tab); | 66 content::WebContents* tab); |
| 67 | 67 |
| 68 FaviconTabHelper* favicon_tab_helper() { | 68 FaviconTabHelper* favicon_tab_helper() { |
| 69 return FaviconTabHelper::FromWebContents(web_contents()); | 69 return FaviconTabHelper::FromWebContents(web_contents()); |
| 70 } | 70 } |
| 71 | 71 |
| 72 // WebContentsObserver overrides: | 72 // WebContentsObserver overrides: |
| 73 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | 73 virtual void RenderProcessGone(base::TerminationStatus status) override; |
| 74 virtual void WebContentsDestroyed() OVERRIDE; | 74 virtual void WebContentsDestroyed() override; |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 HungPagesTableModel* model_; | 77 HungPagesTableModel* model_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(WebContentsObserverImpl); | 79 DISALLOW_COPY_AND_ASSIGN(WebContentsObserverImpl); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 // Invoked when a WebContents is destroyed. Cleans up |tab_observers_| and | 82 // Invoked when a WebContents is destroyed. Cleans up |tab_observers_| and |
| 83 // notifies the observer and delegate. | 83 // notifies the observer and delegate. |
| 84 void TabDestroyed(WebContentsObserverImpl* tab); | 84 void TabDestroyed(WebContentsObserverImpl* tab); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 109 // handle passed in. | 109 // handle passed in. |
| 110 static void KillRendererProcess(base::ProcessHandle process_handle); | 110 static void KillRendererProcess(base::ProcessHandle process_handle); |
| 111 | 111 |
| 112 // Returns true if the frame is in the foreground. | 112 // Returns true if the frame is in the foreground. |
| 113 static bool IsFrameActive(content::WebContents* contents); | 113 static bool IsFrameActive(content::WebContents* contents); |
| 114 | 114 |
| 115 virtual void ShowForWebContents(content::WebContents* contents); | 115 virtual void ShowForWebContents(content::WebContents* contents); |
| 116 virtual void EndForWebContents(content::WebContents* contents); | 116 virtual void EndForWebContents(content::WebContents* contents); |
| 117 | 117 |
| 118 // views::DialogDelegateView overrides: | 118 // views::DialogDelegateView overrides: |
| 119 virtual base::string16 GetWindowTitle() const OVERRIDE; | 119 virtual base::string16 GetWindowTitle() const override; |
| 120 virtual void WindowClosing() OVERRIDE; | 120 virtual void WindowClosing() override; |
| 121 virtual int GetDialogButtons() const OVERRIDE; | 121 virtual int GetDialogButtons() const override; |
| 122 virtual base::string16 GetDialogButtonLabel( | 122 virtual base::string16 GetDialogButtonLabel( |
| 123 ui::DialogButton button) const OVERRIDE; | 123 ui::DialogButton button) const override; |
| 124 virtual views::View* CreateExtraView() OVERRIDE; | 124 virtual views::View* CreateExtraView() override; |
| 125 virtual bool Accept(bool window_closing) OVERRIDE; | 125 virtual bool Accept(bool window_closing) override; |
| 126 virtual bool UseNewStyleForThisDialog() const OVERRIDE; | 126 virtual bool UseNewStyleForThisDialog() const override; |
| 127 | 127 |
| 128 // views::ButtonListener overrides: | 128 // views::ButtonListener overrides: |
| 129 virtual void ButtonPressed(views::Button* sender, | 129 virtual void ButtonPressed(views::Button* sender, |
| 130 const ui::Event& event) OVERRIDE; | 130 const ui::Event& event) override; |
| 131 | 131 |
| 132 // HungPagesTableModel::Delegate overrides: | 132 // HungPagesTableModel::Delegate overrides: |
| 133 virtual void TabDestroyed() OVERRIDE; | 133 virtual void TabDestroyed() override; |
| 134 | 134 |
| 135 protected: | 135 protected: |
| 136 HungRendererDialogView(); | 136 HungRendererDialogView(); |
| 137 virtual ~HungRendererDialogView(); | 137 virtual ~HungRendererDialogView(); |
| 138 | 138 |
| 139 // views::View overrides: | 139 // views::View overrides: |
| 140 virtual void ViewHierarchyChanged( | 140 virtual void ViewHierarchyChanged( |
| 141 const ViewHierarchyChangedDetails& details) OVERRIDE; | 141 const ViewHierarchyChangedDetails& details) override; |
| 142 | 142 |
| 143 static HungRendererDialogView* g_instance_; | 143 static HungRendererDialogView* g_instance_; |
| 144 | 144 |
| 145 private: | 145 private: |
| 146 // Initialize the controls in this dialog. | 146 // Initialize the controls in this dialog. |
| 147 void Init(); | 147 void Init(); |
| 148 | 148 |
| 149 static void InitClass(); | 149 static void InitClass(); |
| 150 | 150 |
| 151 // Controls within the dialog box. | 151 // Controls within the dialog box. |
| 152 views::TableView* hung_pages_table_; | 152 views::TableView* hung_pages_table_; |
| 153 | 153 |
| 154 // The extra button inserted into the ClientView to kill the errant process. | 154 // The extra button inserted into the ClientView to kill the errant process. |
| 155 views::LabelButton* kill_button_; | 155 views::LabelButton* kill_button_; |
| 156 | 156 |
| 157 // The model that provides the contents of the table that shows a list of | 157 // The model that provides the contents of the table that shows a list of |
| 158 // pages affected by the hang. | 158 // pages affected by the hang. |
| 159 scoped_ptr<HungPagesTableModel> hung_pages_table_model_; | 159 scoped_ptr<HungPagesTableModel> hung_pages_table_model_; |
| 160 | 160 |
| 161 // Whether or not we've created controls for ourself. | 161 // Whether or not we've created controls for ourself. |
| 162 bool initialized_; | 162 bool initialized_; |
| 163 | 163 |
| 164 // An amusing icon image. | 164 // An amusing icon image. |
| 165 static gfx::ImageSkia* frozen_icon_; | 165 static gfx::ImageSkia* frozen_icon_; |
| 166 | 166 |
| 167 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogView); | 167 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogView); |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 #endif // CHROME_BROWSER_UI_VIEWS_HUNG_RENDERER_VIEW_H_ | 170 #endif // CHROME_BROWSER_UI_VIEWS_HUNG_RENDERER_VIEW_H_ |
| OLD | NEW |