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

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

Issue 653563004: NULL -> nullptr under athena/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 6 years, 1 month 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/media_utils.h" 10 #include "athena/content/media_utils.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 case NEW_POPUP: 258 case NEW_POPUP:
259 case NEW_WINDOW: { 259 case NEW_WINDOW: {
260 Activity* activity = ActivityFactory::Get()->CreateWebActivity( 260 Activity* activity = ActivityFactory::Get()->CreateWebActivity(
261 browser_context(), base::string16(), params.url); 261 browser_context(), base::string16(), params.url);
262 Activity::Show(activity); 262 Activity::Show(activity);
263 break; 263 break;
264 } 264 }
265 default: 265 default:
266 break; 266 break;
267 } 267 }
268 // NULL is returned if the URL wasn't opened immediately. 268 // nullptr is returned if the URL wasn't opened immediately.
269 return NULL; 269 return nullptr;
270 } 270 }
271 271
272 virtual bool CanOverscrollContent() const override { 272 virtual bool CanOverscrollContent() const override {
273 const std::string value = CommandLine::ForCurrentProcess()-> 273 const std::string value = CommandLine::ForCurrentProcess()->
274 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation); 274 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation);
275 return value != "0"; 275 return value != "0";
276 } 276 }
277 277
278 virtual void OverscrollUpdate(float delta_y) override { 278 virtual void OverscrollUpdate(float delta_y) override {
279 overscroll_y_ = delta_y; 279 overscroll_y_ = delta_y;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 GetWidget()->SetFullscreen(fullscreen_); 331 GetWidget()->SetFullscreen(fullscreen_);
332 } 332 }
333 333
334 virtual bool IsFullscreenForTabOrPending( 334 virtual bool IsFullscreenForTabOrPending(
335 const content::WebContents* web_contents) const override { 335 const content::WebContents* web_contents) const override {
336 return fullscreen_; 336 return fullscreen_;
337 } 337 }
338 338
339 virtual void LoadingStateChanged(content::WebContents* source, 339 virtual void LoadingStateChanged(content::WebContents* source,
340 bool to_different_document) override { 340 bool to_different_document) override {
341 bool has_stopped = source == NULL || !source->IsLoading(); 341 bool has_stopped = source == nullptr || !source->IsLoading();
342 LoadProgressChanged(source, has_stopped ? 1 : 0); 342 LoadProgressChanged(source, has_stopped ? 1 : 0);
343 } 343 }
344 344
345 virtual void LoadProgressChanged(content::WebContents* source, 345 virtual void LoadProgressChanged(content::WebContents* source,
346 double progress) override { 346 double progress) override {
347 if (!progress) 347 if (!progress)
348 return; 348 return;
349 349
350 if (!progress_bar_) { 350 if (!progress_bar_) {
351 CreateProgressBar(); 351 CreateProgressBar();
352 source->GetNativeView()->layer()->Add(progress_bar_.get()); 352 source->GetNativeView()->layer()->Add(progress_bar_.get());
353 } 353 }
354 progress_bar_->SetBounds(gfx::Rect( 354 progress_bar_->SetBounds(gfx::Rect(
355 0, 0, progress * progress_bar_->parent()->bounds().width(), 3)); 355 0, 0, progress * progress_bar_->parent()->bounds().width(), 3));
356 if (progress < 1) 356 if (progress < 1)
357 return; 357 return;
358 358
359 ui::ScopedLayerAnimationSettings settings(progress_bar_->GetAnimator()); 359 ui::ScopedLayerAnimationSettings settings(progress_bar_->GetAnimator());
360 settings.SetTweenType(gfx::Tween::EASE_IN); 360 settings.SetTweenType(gfx::Tween::EASE_IN);
361 ui::Layer* layer = progress_bar_.get(); 361 ui::Layer* layer = progress_bar_.get();
362 settings.AddObserver(new ui::ClosureAnimationObserver( 362 settings.AddObserver(new ui::ClosureAnimationObserver(
363 base::Bind(&base::DeletePointer<ui::Layer>, progress_bar_.release()))); 363 base::Bind(&base::DeletePointer<ui::Layer>, progress_bar_.release())));
364 layer->SetOpacity(0.f); 364 layer->SetOpacity(0.f);
365 } 365 }
366 366
367 virtual content::JavaScriptDialogManager* GetJavaScriptDialogManager() 367 virtual content::JavaScriptDialogManager* GetJavaScriptDialogManager()
368 override { 368 override {
369 NOTIMPLEMENTED(); 369 NOTIMPLEMENTED();
370 return NULL; 370 return nullptr;
371 } 371 }
372 372
373 virtual content::ColorChooser* OpenColorChooser( 373 virtual content::ColorChooser* OpenColorChooser(
374 content::WebContents* web_contents, 374 content::WebContents* web_contents,
375 SkColor color, 375 SkColor color,
376 const std::vector<content::ColorSuggestion>& suggestions) override { 376 const std::vector<content::ColorSuggestion>& suggestions) override {
377 return athena::OpenColorChooser(web_contents, color, suggestions); 377 return athena::OpenColorChooser(web_contents, color, suggestions);
378 } 378 }
379 379
380 // Called when a file selection is to be done. 380 // Called when a file selection is to be done.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 break; 498 break;
499 case ACTIVITY_PERSISTENT: 499 case ACTIVITY_PERSISTENT:
500 DCHECK_EQ(ACTIVITY_BACKGROUND_LOW_PRIORITY, current_state_); 500 DCHECK_EQ(ACTIVITY_BACKGROUND_LOW_PRIORITY, current_state_);
501 // TODO(skuhne): Do this. As soon as the new resource management is 501 // TODO(skuhne): Do this. As soon as the new resource management is
502 // agreed upon - or remove otherwise. 502 // agreed upon - or remove otherwise.
503 break; 503 break;
504 case ACTIVITY_UNLOADED: 504 case ACTIVITY_UNLOADED:
505 DCHECK_NE(ACTIVITY_UNLOADED, current_state_); 505 DCHECK_NE(ACTIVITY_UNLOADED, current_state_);
506 if (content_proxy_) 506 if (content_proxy_)
507 content_proxy_->ContentWillUnload(); 507 content_proxy_->ContentWillUnload();
508 Observe(NULL); 508 Observe(nullptr);
509 web_view_->EvictContent(); 509 web_view_->EvictContent();
510 break; 510 break;
511 } 511 }
512 // Remember the last requested state. 512 // Remember the last requested state.
513 current_state_ = state; 513 current_state_ = state;
514 } 514 }
515 515
516 Activity::ActivityState WebActivity::GetCurrentState() { 516 Activity::ActivityState WebActivity::GetCurrentState() {
517 // If the content is evicted, the state has to be UNLOADED. 517 // If the content is evicted, the state has to be UNLOADED.
518 DCHECK(!web_view_->IsContentEvicted() || 518 DCHECK(!web_view_->IsContentEvicted() ||
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 561
562 bool WebActivity::UsesFrame() const { 562 bool WebActivity::UsesFrame() const {
563 return true; 563 return true;
564 } 564 }
565 565
566 views::View* WebActivity::GetContentsView() { 566 views::View* WebActivity::GetContentsView() {
567 return web_view_; 567 return web_view_;
568 } 568 }
569 569
570 views::Widget* WebActivity::CreateWidget() { 570 views::Widget* WebActivity::CreateWidget() {
571 return NULL; // Use default widget. 571 return nullptr; // Use default widget.
572 } 572 }
573 573
574 gfx::ImageSkia WebActivity::GetOverviewModeImage() { 574 gfx::ImageSkia WebActivity::GetOverviewModeImage() {
575 if (content_proxy_.get()) 575 if (content_proxy_.get())
576 return content_proxy_->GetContentImage(); 576 return content_proxy_->GetContentImage();
577 return gfx::ImageSkia(); 577 return gfx::ImageSkia();
578 } 578 }
579 579
580 void WebActivity::PrepareContentsForOverview() { 580 void WebActivity::PrepareContentsForOverview() {
581 // Turn on fast resizing to avoid re-laying out the web contents when 581 // Turn on fast resizing to avoid re-laying out the web contents when
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 } 627 }
628 } 628 }
629 629
630 void WebActivity::OnDidDownloadFavicon( 630 void WebActivity::OnDidDownloadFavicon(
631 int id, 631 int id,
632 int http_status_code, 632 int http_status_code,
633 const GURL& url, 633 const GURL& url,
634 const std::vector<SkBitmap>& bitmaps, 634 const std::vector<SkBitmap>& bitmaps,
635 const std::vector<gfx::Size>& original_bitmap_sizes) { 635 const std::vector<gfx::Size>& original_bitmap_sizes) {
636 icon_ = CreateFaviconImageSkia( 636 icon_ = CreateFaviconImageSkia(
637 bitmaps, original_bitmap_sizes, kIconSize, NULL); 637 bitmaps, original_bitmap_sizes, kIconSize, nullptr);
638 ActivityManager::Get()->UpdateActivity(this); 638 ActivityManager::Get()->UpdateActivity(this);
639 } 639 }
640 640
641 void WebActivity::DidChangeThemeColor(SkColor theme_color) { 641 void WebActivity::DidChangeThemeColor(SkColor theme_color) {
642 title_color_ = theme_color; 642 title_color_ = theme_color;
643 ActivityManager::Get()->UpdateActivity(this); 643 ActivityManager::Get()->UpdateActivity(this);
644 } 644 }
645 645
646 void WebActivity::HideContentProxy() { 646 void WebActivity::HideContentProxy() {
647 if (content_proxy_.get()) 647 if (content_proxy_.get())
648 content_proxy_.reset(NULL); 648 content_proxy_.reset(nullptr);
649 } 649 }
650 650
651 void WebActivity::ShowContentProxy() { 651 void WebActivity::ShowContentProxy() {
652 if (!content_proxy_.get()) 652 if (!content_proxy_.get())
653 content_proxy_.reset(new ContentProxy(web_view_)); 653 content_proxy_.reset(new ContentProxy(web_view_));
654 } 654 }
655 655
656 } // namespace athena 656 } // namespace athena
OLDNEW
« no previous file with comments | « athena/content/shell/dialogs.cc ('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