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

Side by Side Diff: athena/content/web_activity.cc

Issue 623103002: replace OVERRIDE and FINAL with override and final in athena/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/content/web_activity.h" 5 #include "athena/content/web_activity.h"
6 6
7 #include "athena/activity/public/activity_factory.h" 7 #include "athena/activity/public/activity_factory.h"
8 #include "athena/activity/public/activity_manager.h" 8 #include "athena/activity/public/activity_manager.h"
9 #include "athena/content/content_proxy.h" 9 #include "athena/content/content_proxy.h"
10 #include "athena/content/public/dialogs.h" 10 #include "athena/content/public/dialogs.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 void HandleKeyboardEvent(content::WebContents* source, 96 void HandleKeyboardEvent(content::WebContents* source,
97 const content::NativeWebKeyboardEvent& event) { 97 const content::NativeWebKeyboardEvent& event) {
98 unhandled_keyboard_event_handler_.HandleKeyboardEvent( 98 unhandled_keyboard_event_handler_.HandleKeyboardEvent(
99 event, web_view_->GetFocusManager()); 99 event, web_view_->GetFocusManager());
100 } 100 }
101 101
102 private: 102 private:
103 // AcceleratorHandler: 103 // AcceleratorHandler:
104 virtual bool IsCommandEnabled(int command_id) const OVERRIDE { 104 virtual bool IsCommandEnabled(int command_id) const override {
105 switch (command_id) { 105 switch (command_id) {
106 case CMD_RELOAD: 106 case CMD_RELOAD:
107 case CMD_RELOAD_IGNORE_CACHE: 107 case CMD_RELOAD_IGNORE_CACHE:
108 return true; 108 return true;
109 case CMD_BACK: 109 case CMD_BACK:
110 return web_view_->GetWebContents()->GetController().CanGoBack(); 110 return web_view_->GetWebContents()->GetController().CanGoBack();
111 case CMD_FORWARD: 111 case CMD_FORWARD:
112 return web_view_->GetWebContents()->GetController().CanGoForward(); 112 return web_view_->GetWebContents()->GetController().CanGoForward();
113 case CMD_CLOSE: 113 case CMD_CLOSE:
114 // TODO(oshima): check onbeforeunload handler. 114 // TODO(oshima): check onbeforeunload handler.
115 return true; 115 return true;
116 case CMD_STOP: 116 case CMD_STOP:
117 return web_view_->GetWebContents()->IsLoading(); 117 return web_view_->GetWebContents()->IsLoading();
118 } 118 }
119 return false; 119 return false;
120 } 120 }
121 121
122 virtual bool OnAcceleratorFired(int command_id, 122 virtual bool OnAcceleratorFired(int command_id,
123 const ui::Accelerator& accelerator) OVERRIDE { 123 const ui::Accelerator& accelerator) override {
124 switch (command_id) { 124 switch (command_id) {
125 case CMD_RELOAD: 125 case CMD_RELOAD:
126 web_view_->GetWebContents()->GetController().Reload(false); 126 web_view_->GetWebContents()->GetController().Reload(false);
127 return true; 127 return true;
128 case CMD_RELOAD_IGNORE_CACHE: 128 case CMD_RELOAD_IGNORE_CACHE:
129 web_view_->GetWebContents()->GetController().ReloadIgnoringCache(false); 129 web_view_->GetWebContents()->GetController().ReloadIgnoringCache(false);
130 return true; 130 return true;
131 case CMD_BACK: 131 case CMD_BACK:
132 web_view_->GetWebContents()->GetController().GoBack(); 132 web_view_->GetWebContents()->GetController().GoBack();
133 return true; 133 return true;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 219
220 SwapWebContents(evicted_web_contents_.Pass()); 220 SwapWebContents(evicted_web_contents_.Pass());
221 } 221 }
222 222
223 // Check if the content got evicted. 223 // Check if the content got evicted.
224 const bool IsContentEvicted() { return !!evicted_web_contents_.get(); } 224 const bool IsContentEvicted() { return !!evicted_web_contents_.get(); }
225 225
226 // content::WebContentsDelegate: 226 // content::WebContentsDelegate:
227 virtual content::WebContents* OpenURLFromTab( 227 virtual content::WebContents* OpenURLFromTab(
228 content::WebContents* source, 228 content::WebContents* source,
229 const content::OpenURLParams& params) OVERRIDE { 229 const content::OpenURLParams& params) override {
230 switch(params.disposition) { 230 switch(params.disposition) {
231 case CURRENT_TAB: { 231 case CURRENT_TAB: {
232 DCHECK(source == web_contents()); 232 DCHECK(source == web_contents());
233 content::NavigationController::LoadURLParams load_url_params( 233 content::NavigationController::LoadURLParams load_url_params(
234 params.url); 234 params.url);
235 load_url_params.referrer = params.referrer; 235 load_url_params.referrer = params.referrer;
236 load_url_params.frame_tree_node_id = params.frame_tree_node_id; 236 load_url_params.frame_tree_node_id = params.frame_tree_node_id;
237 load_url_params.transition_type = params.transition; 237 load_url_params.transition_type = params.transition;
238 load_url_params.extra_headers = params.extra_headers; 238 load_url_params.extra_headers = params.extra_headers;
239 load_url_params.should_replace_current_entry = 239 load_url_params.should_replace_current_entry =
(...skipping 13 matching lines...) Expand all
253 Activity::Show(activity); 253 Activity::Show(activity);
254 break; 254 break;
255 } 255 }
256 default: 256 default:
257 break; 257 break;
258 } 258 }
259 // NULL is returned if the URL wasn't opened immediately. 259 // NULL is returned if the URL wasn't opened immediately.
260 return NULL; 260 return NULL;
261 } 261 }
262 262
263 virtual bool CanOverscrollContent() const OVERRIDE { 263 virtual bool CanOverscrollContent() const override {
264 const std::string value = CommandLine::ForCurrentProcess()-> 264 const std::string value = CommandLine::ForCurrentProcess()->
265 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation); 265 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation);
266 return value != "0"; 266 return value != "0";
267 } 267 }
268 268
269 virtual void OverscrollUpdate(int delta_y) OVERRIDE { 269 virtual void OverscrollUpdate(int delta_y) override {
270 overscroll_y_ = delta_y; 270 overscroll_y_ = delta_y;
271 if (overscroll_y_ > kDistanceShowReloadMessage) { 271 if (overscroll_y_ > kDistanceShowReloadMessage) {
272 if (!reload_message_) 272 if (!reload_message_)
273 CreateReloadMessage(); 273 CreateReloadMessage();
274 reload_message_->Show(); 274 reload_message_->Show();
275 float opacity = 1.0f; 275 float opacity = 1.0f;
276 if (overscroll_y_ < kDistanceReload) { 276 if (overscroll_y_ < kDistanceReload) {
277 opacity = 277 opacity =
278 (overscroll_y_ - kDistanceShowReloadMessage) / 278 (overscroll_y_ - kDistanceShowReloadMessage) /
279 static_cast<float>(kDistanceReload - kDistanceShowReloadMessage); 279 static_cast<float>(kDistanceReload - kDistanceShowReloadMessage);
280 } 280 }
281 reload_message_->GetLayer()->SetOpacity(opacity); 281 reload_message_->GetLayer()->SetOpacity(opacity);
282 } else if (reload_message_) { 282 } else if (reload_message_) {
283 reload_message_->Hide(); 283 reload_message_->Hide();
284 } 284 }
285 } 285 }
286 286
287 virtual void OverscrollComplete() OVERRIDE { 287 virtual void OverscrollComplete() override {
288 if (overscroll_y_ >= kDistanceReload) 288 if (overscroll_y_ >= kDistanceReload)
289 GetWebContents()->GetController().Reload(false); 289 GetWebContents()->GetController().Reload(false);
290 if (reload_message_) 290 if (reload_message_)
291 reload_message_->Hide(); 291 reload_message_->Hide();
292 overscroll_y_ = 0; 292 overscroll_y_ = 0;
293 } 293 }
294 294
295 virtual void AddNewContents(content::WebContents* source, 295 virtual void AddNewContents(content::WebContents* source,
296 content::WebContents* new_contents, 296 content::WebContents* new_contents,
297 WindowOpenDisposition disposition, 297 WindowOpenDisposition disposition,
298 const gfx::Rect& initial_pos, 298 const gfx::Rect& initial_pos,
299 bool user_gesture, 299 bool user_gesture,
300 bool* was_blocked) OVERRIDE { 300 bool* was_blocked) override {
301 // TODO(oshima): Use factory. 301 // TODO(oshima): Use factory.
302 ActivityManager::Get()->AddActivity( 302 ActivityManager::Get()->AddActivity(
303 new WebActivity(new AthenaWebView(new_contents))); 303 new WebActivity(new AthenaWebView(new_contents)));
304 } 304 }
305 305
306 virtual bool PreHandleKeyboardEvent( 306 virtual bool PreHandleKeyboardEvent(
307 content::WebContents* source, 307 content::WebContents* source,
308 const content::NativeWebKeyboardEvent& event, 308 const content::NativeWebKeyboardEvent& event,
309 bool* is_keyboard_shortcut) OVERRIDE { 309 bool* is_keyboard_shortcut) override {
310 return controller_->PreHandleKeyboardEvent( 310 return controller_->PreHandleKeyboardEvent(
311 source, event, is_keyboard_shortcut); 311 source, event, is_keyboard_shortcut);
312 } 312 }
313 313
314 virtual void HandleKeyboardEvent( 314 virtual void HandleKeyboardEvent(
315 content::WebContents* source, 315 content::WebContents* source,
316 const content::NativeWebKeyboardEvent& event) OVERRIDE { 316 const content::NativeWebKeyboardEvent& event) override {
317 controller_->HandleKeyboardEvent(source, event); 317 controller_->HandleKeyboardEvent(source, event);
318 } 318 }
319 319
320 virtual void ToggleFullscreenModeForTab(content::WebContents* web_contents, 320 virtual void ToggleFullscreenModeForTab(content::WebContents* web_contents,
321 bool enter_fullscreen) OVERRIDE { 321 bool enter_fullscreen) override {
322 fullscreen_ = enter_fullscreen; 322 fullscreen_ = enter_fullscreen;
323 GetWidget()->SetFullscreen(fullscreen_); 323 GetWidget()->SetFullscreen(fullscreen_);
324 } 324 }
325 325
326 virtual bool IsFullscreenForTabOrPending( 326 virtual bool IsFullscreenForTabOrPending(
327 const content::WebContents* web_contents) const OVERRIDE { 327 const content::WebContents* web_contents) const override {
328 return fullscreen_; 328 return fullscreen_;
329 } 329 }
330 330
331 virtual void LoadingStateChanged(content::WebContents* source, 331 virtual void LoadingStateChanged(content::WebContents* source,
332 bool to_different_document) OVERRIDE { 332 bool to_different_document) override {
333 bool has_stopped = source == NULL || !source->IsLoading(); 333 bool has_stopped = source == NULL || !source->IsLoading();
334 LoadProgressChanged(source, has_stopped ? 1 : 0); 334 LoadProgressChanged(source, has_stopped ? 1 : 0);
335 } 335 }
336 336
337 virtual void LoadProgressChanged(content::WebContents* source, 337 virtual void LoadProgressChanged(content::WebContents* source,
338 double progress) OVERRIDE { 338 double progress) override {
339 if (!progress) 339 if (!progress)
340 return; 340 return;
341 341
342 if (!progress_bar_) { 342 if (!progress_bar_) {
343 CreateProgressBar(); 343 CreateProgressBar();
344 source->GetNativeView()->layer()->Add(progress_bar_.get()); 344 source->GetNativeView()->layer()->Add(progress_bar_.get());
345 } 345 }
346 progress_bar_->SetBounds(gfx::Rect( 346 progress_bar_->SetBounds(gfx::Rect(
347 0, 0, progress * progress_bar_->parent()->bounds().width(), 3)); 347 0, 0, progress * progress_bar_->parent()->bounds().width(), 3));
348 if (progress < 1) 348 if (progress < 1)
349 return; 349 return;
350 350
351 ui::ScopedLayerAnimationSettings settings(progress_bar_->GetAnimator()); 351 ui::ScopedLayerAnimationSettings settings(progress_bar_->GetAnimator());
352 settings.SetTweenType(gfx::Tween::EASE_IN); 352 settings.SetTweenType(gfx::Tween::EASE_IN);
353 ui::Layer* layer = progress_bar_.get(); 353 ui::Layer* layer = progress_bar_.get();
354 settings.AddObserver(new ui::ClosureAnimationObserver( 354 settings.AddObserver(new ui::ClosureAnimationObserver(
355 base::Bind(&base::DeletePointer<ui::Layer>, progress_bar_.release()))); 355 base::Bind(&base::DeletePointer<ui::Layer>, progress_bar_.release())));
356 layer->SetOpacity(0.f); 356 layer->SetOpacity(0.f);
357 } 357 }
358 358
359 virtual content::ColorChooser* OpenColorChooser( 359 virtual content::ColorChooser* OpenColorChooser(
360 content::WebContents* web_contents, 360 content::WebContents* web_contents,
361 SkColor color, 361 SkColor color,
362 const std::vector<content::ColorSuggestion>& suggestions) OVERRIDE { 362 const std::vector<content::ColorSuggestion>& suggestions) override {
363 return athena::OpenColorChooser(web_contents, color, suggestions); 363 return athena::OpenColorChooser(web_contents, color, suggestions);
364 } 364 }
365 365
366 // Called when a file selection is to be done. 366 // Called when a file selection is to be done.
367 virtual void RunFileChooser( 367 virtual void RunFileChooser(
368 content::WebContents* web_contents, 368 content::WebContents* web_contents,
369 const content::FileChooserParams& params) OVERRIDE { 369 const content::FileChooserParams& params) override {
370 return athena::OpenFileChooser(web_contents, params); 370 return athena::OpenFileChooser(web_contents, params);
371 } 371 }
372 372
373 private: 373 private:
374 void CreateProgressBar() { 374 void CreateProgressBar() {
375 CHECK(!progress_bar_); 375 CHECK(!progress_bar_);
376 progress_bar_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); 376 progress_bar_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
377 progress_bar_->SetColor(SkColorSetRGB(0x17, 0x59, 0xcd)); 377 progress_bar_->SetColor(SkColorSetRGB(0x17, 0x59, 0xcd));
378 } 378 }
379 379
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 if (content_proxy_.get()) 625 if (content_proxy_.get())
626 content_proxy_.reset(NULL); 626 content_proxy_.reset(NULL);
627 } 627 }
628 628
629 void WebActivity::ShowContentProxy() { 629 void WebActivity::ShowContentProxy() {
630 if (!content_proxy_.get()) 630 if (!content_proxy_.get())
631 content_proxy_.reset(new ContentProxy(web_view_)); 631 content_proxy_.reset(new ContentProxy(web_view_));
632 } 632 }
633 633
634 } // namespace athena 634 } // namespace athena
OLDNEW
« no previous file with comments | « athena/content/web_activity.h ('k') | athena/content/web_contents_view_delegate_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698