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/panels/panel_host.h" | 5 #include "chrome/browser/ui/panels/panel_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/chrome_page_zoom.h" | 10 #include "chrome/browser/chrome_page_zoom.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 if (params.disposition == SUPPRESS_OPEN || | 81 if (params.disposition == SUPPRESS_OPEN || |
82 params.disposition == SAVE_TO_DISK || | 82 params.disposition == SAVE_TO_DISK || |
83 params.disposition == IGNORE_ACTION) | 83 params.disposition == IGNORE_ACTION) |
84 return NULL; | 84 return NULL; |
85 | 85 |
86 // Only allow clicks on links. | 86 // Only allow clicks on links. |
87 if (params.transition != content::PAGE_TRANSITION_LINK) | 87 if (params.transition != content::PAGE_TRANSITION_LINK) |
88 return NULL; | 88 return NULL; |
89 | 89 |
90 // Force all links to open in a new tab. | 90 // Force all links to open in a new tab. |
91 chrome::NavigateParams navigate_params( | 91 chrome::NavigateParams navigate_params(profile_, |
92 browser::FindOrCreateTabbedBrowser(profile_), | 92 params.url, |
93 params.url, params.transition); | 93 params.transition); |
94 navigate_params.disposition = params.disposition == NEW_BACKGROUND_TAB ? | 94 navigate_params.disposition = params.disposition == NEW_BACKGROUND_TAB ? |
95 params.disposition : NEW_FOREGROUND_TAB; | 95 params.disposition : NEW_FOREGROUND_TAB; |
96 chrome::Navigate(&navigate_params); | 96 chrome::Navigate(&navigate_params); |
97 return navigate_params.target_contents ? | 97 return navigate_params.target_contents ? |
98 navigate_params.target_contents->web_contents() : NULL; | 98 navigate_params.target_contents->web_contents() : NULL; |
99 } | 99 } |
100 | 100 |
101 void PanelHost::NavigationStateChanged(const content::WebContents* source, | 101 void PanelHost::NavigationStateChanged(const content::WebContents* source, |
102 unsigned changed_flags) { | 102 unsigned changed_flags) { |
103 // Only need to update the title if the title changed while not loading, | 103 // Only need to update the title if the title changed while not loading, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 214 } |
215 | 215 |
216 void PanelHost::StopLoading() { | 216 void PanelHost::StopLoading() { |
217 content::RecordAction(UserMetricsAction("Stop")); | 217 content::RecordAction(UserMetricsAction("Stop")); |
218 web_contents_->Stop(); | 218 web_contents_->Stop(); |
219 } | 219 } |
220 | 220 |
221 void PanelHost::Zoom(content::PageZoom zoom) { | 221 void PanelHost::Zoom(content::PageZoom zoom) { |
222 chrome_page_zoom::Zoom(web_contents_.get(), zoom); | 222 chrome_page_zoom::Zoom(web_contents_.get(), zoom); |
223 } | 223 } |
OLD | NEW |