OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util.h" | 5 #include "app/l10n_util.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 class FloatingWindow : public DevToolsWindow, | 30 class FloatingWindow : public DevToolsWindow, |
31 TabStripModelObserver { | 31 TabStripModelObserver { |
32 public: | 32 public: |
33 FloatingWindow(Profile* profile); | 33 FloatingWindow(Profile* profile); |
34 virtual ~FloatingWindow(); | 34 virtual ~FloatingWindow(); |
35 virtual void Show(); | 35 virtual void Show(); |
| 36 virtual void Activate(); |
36 virtual void InspectedTabClosing(); | 37 virtual void InspectedTabClosing(); |
37 | 38 |
38 // TabStripModelObserver implementation | 39 // TabStripModelObserver implementation |
39 virtual void TabClosingAt(TabContents* contents, int index); | 40 virtual void TabClosingAt(TabContents* contents, int index); |
40 virtual void TabStripEmpty(); | 41 virtual void TabStripEmpty(); |
41 | 42 |
42 private: | 43 private: |
43 bool inspected_tab_closing_; | 44 bool inspected_tab_closing_; |
44 DISALLOW_COPY_AND_ASSIGN(FloatingWindow); | 45 DISALLOW_COPY_AND_ASSIGN(FloatingWindow); |
45 }; | 46 }; |
46 | 47 |
47 class DockedWindow : public DevToolsWindow, | 48 class DockedWindow : public DevToolsWindow, |
48 TabContentsDelegate { | 49 TabContentsDelegate { |
49 public: | 50 public: |
50 DockedWindow(Profile* profile, BrowserWindow* window); | 51 DockedWindow(Profile* profile, BrowserWindow* window); |
51 virtual ~DockedWindow(); | 52 virtual ~DockedWindow(); |
| 53 virtual void Activate() {} |
52 virtual void Show(); | 54 virtual void Show(); |
53 virtual void InspectedTabClosing(); | 55 virtual void InspectedTabClosing(); |
54 | 56 |
55 private: | 57 private: |
56 // Overridden from TabContentsDelegate: | 58 // Overridden from TabContentsDelegate: |
57 virtual void OpenURLFromTab(TabContents* source, | 59 virtual void OpenURLFromTab(TabContents* source, |
58 const GURL& url, | 60 const GURL& url, |
59 const GURL& referrer, | 61 const GURL& referrer, |
60 WindowOpenDisposition disposition, | 62 WindowOpenDisposition disposition, |
61 PageTransition::Type transition) {} | 63 PageTransition::Type transition) {} |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 NavigationEntry* entry = tab_contents->controller().GetActiveEntry(); | 211 NavigationEntry* entry = tab_contents->controller().GetActiveEntry(); |
210 entry->favicon().set_bitmap(SkBitmap()); | 212 entry->favicon().set_bitmap(SkBitmap()); |
211 entry->favicon().set_is_valid(true); | 213 entry->favicon().set_is_valid(true); |
212 | 214 |
213 InitTabContents(tab_contents); | 215 InitTabContents(tab_contents); |
214 } | 216 } |
215 | 217 |
216 FloatingWindow::~FloatingWindow() { | 218 FloatingWindow::~FloatingWindow() { |
217 } | 219 } |
218 | 220 |
| 221 void FloatingWindow::Activate() { |
| 222 if (!browser_->window()->IsActive()) { |
| 223 browser_->window()->Activate(); |
| 224 } |
| 225 } |
| 226 |
219 void FloatingWindow::Show() { | 227 void FloatingWindow::Show() { |
220 browser_->window()->Show(); | 228 browser_->window()->Show(); |
221 tab_contents_->view()->SetInitialFocus(); | 229 tab_contents_->view()->SetInitialFocus(); |
222 } | 230 } |
223 | 231 |
224 void FloatingWindow::InspectedTabClosing() { | 232 void FloatingWindow::InspectedTabClosing() { |
225 inspected_tab_closing_ = true; | 233 inspected_tab_closing_ = true; |
226 browser_->CloseAllTabs(); | 234 browser_->CloseAllTabs(); |
227 } | 235 } |
228 | 236 |
(...skipping 29 matching lines...) Expand all Loading... |
258 | 266 |
259 void DockedWindow::Show() { | 267 void DockedWindow::Show() { |
260 window_->UpdateDevTools(); | 268 window_->UpdateDevTools(); |
261 tab_contents_->view()->SetInitialFocus(); | 269 tab_contents_->view()->SetInitialFocus(); |
262 } | 270 } |
263 | 271 |
264 void DockedWindow::InspectedTabClosing() { | 272 void DockedWindow::InspectedTabClosing() { |
265 window_->UpdateDevTools(); | 273 window_->UpdateDevTools(); |
266 delete this; | 274 delete this; |
267 } | 275 } |
OLD | NEW |