Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: content/shell/shell.cc

Issue 12334073: Remove WebContents methods that duplicate WebContentsView methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/public/test/web_contents_tester.cc ('k') | content/shell/shell_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/shell/shell.h" 5 #include "content/shell/shell.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void Shell::LoadURL(const GURL& url) { 149 void Shell::LoadURL(const GURL& url) {
150 LoadURLForFrame(url, std::string()); 150 LoadURLForFrame(url, std::string());
151 } 151 }
152 152
153 void Shell::LoadURLForFrame(const GURL& url, const std::string& frame_name) { 153 void Shell::LoadURLForFrame(const GURL& url, const std::string& frame_name) {
154 NavigationController::LoadURLParams params(url); 154 NavigationController::LoadURLParams params(url);
155 params.transition_type = PageTransitionFromInt( 155 params.transition_type = PageTransitionFromInt(
156 PAGE_TRANSITION_TYPED | PAGE_TRANSITION_FROM_ADDRESS_BAR); 156 PAGE_TRANSITION_TYPED | PAGE_TRANSITION_FROM_ADDRESS_BAR);
157 params.frame_name = frame_name; 157 params.frame_name = frame_name;
158 web_contents_->GetController().LoadURLWithParams(params); 158 web_contents_->GetController().LoadURLWithParams(params);
159 web_contents_->Focus(); 159 web_contents_->GetView()->Focus();
160 } 160 }
161 161
162 void Shell::GoBackOrForward(int offset) { 162 void Shell::GoBackOrForward(int offset) {
163 web_contents_->GetController().GoToOffset(offset); 163 web_contents_->GetController().GoToOffset(offset);
164 web_contents_->Focus(); 164 web_contents_->GetView()->Focus();
165 } 165 }
166 166
167 void Shell::Reload() { 167 void Shell::Reload() {
168 web_contents_->GetController().Reload(false); 168 web_contents_->GetController().Reload(false);
169 web_contents_->Focus(); 169 web_contents_->GetView()->Focus();
170 } 170 }
171 171
172 void Shell::Stop() { 172 void Shell::Stop() {
173 web_contents_->Stop(); 173 web_contents_->Stop();
174 web_contents_->Focus(); 174 web_contents_->GetView()->Focus();
175 } 175 }
176 176
177 void Shell::UpdateNavigationControls() { 177 void Shell::UpdateNavigationControls() {
178 int current_index = web_contents_->GetController().GetCurrentEntryIndex(); 178 int current_index = web_contents_->GetController().GetCurrentEntryIndex();
179 int max_index = web_contents_->GetController().GetEntryCount() - 1; 179 int max_index = web_contents_->GetController().GetEntryCount() - 1;
180 180
181 PlatformEnableUIControl(BACK_BUTTON, current_index > 0); 181 PlatformEnableUIControl(BACK_BUTTON, current_index > 0);
182 PlatformEnableUIControl(FORWARD_BUTTON, current_index < max_index); 182 PlatformEnableUIControl(FORWARD_BUTTON, current_index < max_index);
183 PlatformEnableUIControl(STOP_BUTTON, web_contents_->IsLoading()); 183 PlatformEnableUIControl(STOP_BUTTON, web_contents_->IsLoading());
184 } 184 }
185 185
186 void Shell::ShowDevTools() { 186 void Shell::ShowDevTools() {
187 if (devtools_frontend_) { 187 if (devtools_frontend_) {
188 devtools_frontend_->Focus(); 188 devtools_frontend_->Focus();
189 return; 189 return;
190 } 190 }
191 devtools_frontend_ = ShellDevToolsFrontend::Show(web_contents()); 191 devtools_frontend_ = ShellDevToolsFrontend::Show(web_contents());
192 } 192 }
193 193
194 void Shell::CloseDevTools() { 194 void Shell::CloseDevTools() {
195 if (!devtools_frontend_) 195 if (!devtools_frontend_)
196 return; 196 return;
197 devtools_frontend_->Close(); 197 devtools_frontend_->Close();
198 devtools_frontend_ = NULL; 198 devtools_frontend_ = NULL;
199 } 199 }
200 200
201 gfx::NativeView Shell::GetContentView() { 201 gfx::NativeView Shell::GetContentView() {
202 if (!web_contents_.get()) 202 if (!web_contents_.get())
203 return NULL; 203 return NULL;
204 return web_contents_->GetNativeView(); 204 return web_contents_->GetView()->GetNativeView();
205 } 205 }
206 206
207 WebContents* Shell::OpenURLFromTab(WebContents* source, 207 WebContents* Shell::OpenURLFromTab(WebContents* source,
208 const OpenURLParams& params) { 208 const OpenURLParams& params) {
209 // The only one we implement for now. 209 // The only one we implement for now.
210 DCHECK(params.disposition == CURRENT_TAB); 210 DCHECK(params.disposition == CURRENT_TAB);
211 source->GetController().LoadURL( 211 source->GetController().LoadURL(
212 params.url, params.referrer, params.transition, std::string()); 212 params.url, params.referrer, params.transition, std::string());
213 return source; 213 return source;
214 } 214 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 Details<std::pair<NavigationEntry*, bool> >(details).ptr(); 296 Details<std::pair<NavigationEntry*, bool> >(details).ptr();
297 297
298 if (title->first) { 298 if (title->first) {
299 string16 text = title->first->GetTitle(); 299 string16 text = title->first->GetTitle();
300 PlatformSetTitle(text); 300 PlatformSetTitle(text);
301 } 301 }
302 } 302 }
303 } 303 }
304 304
305 } // namespace content 305 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/web_contents_tester.cc ('k') | content/shell/shell_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698