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

Side by Side Diff: chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge LKGR. Created 8 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 | Annotate | Revision Log
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 "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" 5 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.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 "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/extensions/tab_helper.h" 10 #include "chrome/browser/extensions/tab_helper.h"
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 GetActiveIndex(); 495 GetActiveIndex();
496 if (index == -1) 496 if (index == -1)
497 return; 497 return;
498 SetTabDataAt(web_contents ? web_contents : 498 SetTabDataAt(web_contents ? web_contents :
499 chrome::GetWebContentsAt(browser_, index), index); 499 chrome::GetWebContentsAt(browser_, index), index);
500 } 500 }
501 501
502 //////////////////////////////////////////////////////////////////////////////// 502 ////////////////////////////////////////////////////////////////////////////////
503 // BrowserTabStripController, content::NotificationObserver implementation: 503 // BrowserTabStripController, content::NotificationObserver implementation:
504 504
505 void BrowserTabStripController::Observe(int type, 505 void BrowserTabStripController::OnPreferenceChanged(
506 const content::NotificationSource& source, 506 PrefServiceBase* service,
507 const content::NotificationDetails& details) { 507 const std::string& pref_name) {
508 switch (type) { 508 if (pref_name == prefs::kTabStripLayoutType) {
509 case chrome::NOTIFICATION_PREF_CHANGED: 509 UpdateLayoutType();
510 if (*content::Details<std::string>(details).ptr() ==
511 prefs::kTabStripLayoutType) {
512 UpdateLayoutType();
513 }
514 break;
515
516 default:
517 NOTREACHED();
518 break;
519 } 510 }
520 } 511 }
521 512
522 void BrowserTabStripController::SetTabRendererDataFromModel( 513 void BrowserTabStripController::SetTabRendererDataFromModel(
523 WebContents* contents, 514 WebContents* contents,
524 int model_index, 515 int model_index,
525 TabRendererData* data, 516 TabRendererData* data,
526 TabStatus tab_status) { 517 TabStatus tab_status) {
527 FaviconTabHelper* favicon_tab_helper = 518 FaviconTabHelper* favicon_tab_helper =
528 FaviconTabHelper::FromWebContents(contents); 519 FaviconTabHelper::FromWebContents(contents);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 SetTabRendererDataFromModel(contents->web_contents(), index, &data, NEW_TAB); 585 SetTabRendererDataFromModel(contents->web_contents(), index, &data, NEW_TAB);
595 tabstrip_->AddTabAt(index, data, is_active); 586 tabstrip_->AddTabAt(index, data, is_active);
596 } 587 }
597 588
598 void BrowserTabStripController::UpdateLayoutType() { 589 void BrowserTabStripController::UpdateLayoutType() {
599 bool adjust_layout = false; 590 bool adjust_layout = false;
600 TabStripLayoutType layout_type = 591 TabStripLayoutType layout_type =
601 DetermineTabStripLayout(g_browser_process->local_state(), &adjust_layout); 592 DetermineTabStripLayout(g_browser_process->local_state(), &adjust_layout);
602 tabstrip_->SetLayoutType(layout_type, adjust_layout); 593 tabstrip_->SetLayoutType(layout_type, adjust_layout);
603 } 594 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698