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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 1251633002: Add BubbleManager to manage bubbles and ChromeBubbleManager for events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn nit Created 5 years, 3 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
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/chrome_bubble_manager.h » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 Browser::~Browser() { 464 Browser::~Browser() {
465 // Stop observing notifications before continuing with destruction. Profile 465 // Stop observing notifications before continuing with destruction. Profile
466 // destruction will unload extensions and reentrant calls to Browser:: should 466 // destruction will unload extensions and reentrant calls to Browser:: should
467 // be avoided while it is being torn down. 467 // be avoided while it is being torn down.
468 registrar_.RemoveAll(); 468 registrar_.RemoveAll();
469 extension_registry_observer_.RemoveAll(); 469 extension_registry_observer_.RemoveAll();
470 470
471 // The tab strip should not have any tabs at this point. 471 // The tab strip should not have any tabs at this point.
472 DCHECK(tab_strip_model_->empty()); 472 DCHECK(tab_strip_model_->empty());
473 tab_strip_model_->RemoveObserver(this); 473 tab_strip_model_->RemoveObserver(this);
474 bubble_manager_.reset();
474 475
475 // Destroy the BrowserCommandController before removing the browser, so that 476 // Destroy the BrowserCommandController before removing the browser, so that
476 // it doesn't act on any notifications that are sent as a result of removing 477 // it doesn't act on any notifications that are sent as a result of removing
477 // the browser. 478 // the browser.
478 command_controller_.reset(); 479 command_controller_.reset();
479 BrowserList::RemoveBrowser(this); 480 BrowserList::RemoveBrowser(this);
480 481
481 SessionService* session_service = 482 SessionService* session_service =
482 SessionServiceFactory::GetForProfile(profile_); 483 SessionServiceFactory::GetForProfile(profile_);
483 if (session_service) 484 if (session_service)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 if (OkToCloseWithInProgressDownloads(&num_downloads) == 543 if (OkToCloseWithInProgressDownloads(&num_downloads) ==
543 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN && 544 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN &&
544 !browser_defaults::kBrowserAliveWithNoWindows) { 545 !browser_defaults::kBrowserAliveWithNoWindows) {
545 DownloadService::CancelAllDownloads(); 546 DownloadService::CancelAllDownloads();
546 } 547 }
547 } 548 }
548 549
549 /////////////////////////////////////////////////////////////////////////////// 550 ///////////////////////////////////////////////////////////////////////////////
550 // Getters & Setters 551 // Getters & Setters
551 552
553 ChromeBubbleManager* Browser::GetBubbleManager() {
554 if (!bubble_manager_)
555 bubble_manager_.reset(new ChromeBubbleManager(tab_strip_model_.get()));
556 return bubble_manager_.get();
557 }
558
552 FindBarController* Browser::GetFindBarController() { 559 FindBarController* Browser::GetFindBarController() {
553 if (!find_bar_controller_.get()) { 560 if (!find_bar_controller_.get()) {
554 FindBar* find_bar = window_->CreateFindBar(); 561 FindBar* find_bar = window_->CreateFindBar();
555 find_bar_controller_.reset(new FindBarController(find_bar)); 562 find_bar_controller_.reset(new FindBarController(find_bar));
556 find_bar->SetFindBarController(find_bar_controller_.get()); 563 find_bar->SetFindBarController(find_bar_controller_.get());
557 find_bar_controller_->ChangeWebContents( 564 find_bar_controller_->ChangeWebContents(
558 tab_strip_model_->GetActiveWebContents()); 565 tab_strip_model_->GetActiveWebContents());
559 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect()); 566 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect());
560 } 567 }
561 return find_bar_controller_.get(); 568 return find_bar_controller_.get();
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after
2656 if (contents && !allow_js_access) { 2663 if (contents && !allow_js_access) {
2657 contents->web_contents()->GetController().LoadURL( 2664 contents->web_contents()->GetController().LoadURL(
2658 target_url, 2665 target_url,
2659 content::Referrer(), 2666 content::Referrer(),
2660 ui::PAGE_TRANSITION_LINK, 2667 ui::PAGE_TRANSITION_LINK,
2661 std::string()); // No extra headers. 2668 std::string()); // No extra headers.
2662 } 2669 }
2663 2670
2664 return contents != NULL; 2671 return contents != NULL;
2665 } 2672 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/chrome_bubble_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698