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 #include "chrome/browser/ui/browser_tabstrip.h" | 5 #include "chrome/browser/ui/browser_tabstrip.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 NavigateParams params(browser, url, transition); | 41 NavigateParams params(browser, url, transition); |
42 params.disposition = NEW_FOREGROUND_TAB; | 42 params.disposition = NEW_FOREGROUND_TAB; |
43 Navigate(¶ms); | 43 Navigate(¶ms); |
44 return params.target_contents; | 44 return params.target_contents; |
45 } | 45 } |
46 | 46 |
47 void AddWebContents(Browser* browser, | 47 void AddWebContents(Browser* browser, |
48 content::WebContents* source_contents, | 48 content::WebContents* source_contents, |
49 content::WebContents* new_contents, | 49 content::WebContents* new_contents, |
50 WindowOpenDisposition disposition, | 50 WindowOpenDisposition disposition, |
51 const gfx::Rect& initial_pos, | 51 const gfx::Rect& initial_rect, |
52 bool user_gesture, | 52 bool user_gesture, |
53 bool* was_blocked) { | 53 bool* was_blocked) { |
54 // No code for this yet. | 54 // No code for this yet. |
55 DCHECK(disposition != SAVE_TO_DISK); | 55 DCHECK(disposition != SAVE_TO_DISK); |
56 // Can't create a new contents for the current tab - invalid case. | 56 // Can't create a new contents for the current tab - invalid case. |
57 DCHECK(disposition != CURRENT_TAB); | 57 DCHECK(disposition != CURRENT_TAB); |
58 | 58 |
59 NavigateParams params(browser, new_contents); | 59 NavigateParams params(browser, new_contents); |
60 params.source_contents = source_contents; | 60 params.source_contents = source_contents; |
61 params.disposition = disposition; | 61 params.disposition = disposition; |
62 params.window_bounds = initial_pos; | 62 params.window_bounds = initial_rect; |
63 params.window_action = NavigateParams::SHOW_WINDOW; | 63 params.window_action = NavigateParams::SHOW_WINDOW; |
64 // At this point, we're already beyond the popup blocker. Even if the popup | 64 // At this point, we're already beyond the popup blocker. Even if the popup |
65 // was created without a user gesture, we have to set |user_gesture| to true, | 65 // was created without a user gesture, we have to set |user_gesture| to true, |
66 // so it gets correctly focused. | 66 // so it gets correctly focused. |
67 params.user_gesture = true; | 67 params.user_gesture = true; |
68 Navigate(¶ms); | 68 Navigate(¶ms); |
69 } | 69 } |
70 | 70 |
71 void CloseWebContents(Browser* browser, | 71 void CloseWebContents(Browser* browser, |
72 content::WebContents* contents, | 72 content::WebContents* contents, |
73 bool add_to_history) { | 73 bool add_to_history) { |
74 int index = browser->tab_strip_model()->GetIndexOfWebContents(contents); | 74 int index = browser->tab_strip_model()->GetIndexOfWebContents(contents); |
75 if (index == TabStripModel::kNoTab) { | 75 if (index == TabStripModel::kNoTab) { |
76 NOTREACHED() << "CloseWebContents called for tab not in our strip"; | 76 NOTREACHED() << "CloseWebContents called for tab not in our strip"; |
77 return; | 77 return; |
78 } | 78 } |
79 | 79 |
80 browser->tab_strip_model()->CloseWebContentsAt( | 80 browser->tab_strip_model()->CloseWebContentsAt( |
81 index, | 81 index, |
82 add_to_history ? TabStripModel::CLOSE_CREATE_HISTORICAL_TAB | 82 add_to_history ? TabStripModel::CLOSE_CREATE_HISTORICAL_TAB |
83 : TabStripModel::CLOSE_NONE); | 83 : TabStripModel::CLOSE_NONE); |
84 } | 84 } |
85 | 85 |
86 } // namespace chrome | 86 } // namespace chrome |
OLD | NEW |