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

Side by Side Diff: chrome/browser/cocoa/cookies_window_controller.mm

Issue 650110: Teach the cookie tree view / model about appcaches. Not hooked up to real dat... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #import "chrome/browser/cocoa/cookies_window_controller.h" 5 #import "chrome/browser/cocoa/cookies_window_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "app/l10n_util_mac.h" 9 #include "app/l10n_util_mac.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 - (NSView*)databaseInfoView { 384 - (NSView*)databaseInfoView {
385 return databaseInfo_; 385 return databaseInfo_;
386 } 386 }
387 387
388 // Re-initializes the |treeModel_|, creates a new observer for it, and re- 388 // Re-initializes the |treeModel_|, creates a new observer for it, and re-
389 // builds the |cocoaTreeModel_|. We use this to initialize the controller and 389 // builds the |cocoaTreeModel_|. We use this to initialize the controller and
390 // to rebuild after the user clears browsing data. Because the models get 390 // to rebuild after the user clears browsing data. Because the models get
391 // clobbered, we rebuild the icon cache for safety (though they do not change). 391 // clobbered, we rebuild the icon cache for safety (though they do not change).
392 - (void)loadTreeModelFromProfile { 392 - (void)loadTreeModelFromProfile {
393 treeModel_.reset(new CookiesTreeModel(profile_, databaseHelper_, 393 treeModel_.reset(new CookiesTreeModel(profile_, databaseHelper_,
394 storageHelper_)); 394 storageHelper_, nil));
395 modelObserver_.reset(new CookiesTreeModelObserverBridge(self)); 395 modelObserver_.reset(new CookiesTreeModelObserverBridge(self));
396 treeModel_->AddObserver(modelObserver_.get()); 396 treeModel_->AddObserver(modelObserver_.get());
397 397
398 // Convert the model's icons from Skia to Cocoa. 398 // Convert the model's icons from Skia to Cocoa.
399 std::vector<SkBitmap> skiaIcons; 399 std::vector<SkBitmap> skiaIcons;
400 treeModel_->GetIcons(&skiaIcons); 400 treeModel_->GetIcons(&skiaIcons);
401 icons_.reset([[NSMutableArray alloc] init]); 401 icons_.reset([[NSMutableArray alloc] init]);
402 for (std::vector<SkBitmap>::iterator it = skiaIcons.begin(); 402 for (std::vector<SkBitmap>::iterator it = skiaIcons.begin();
403 it != skiaIcons.end(); ++it) { 403 it != skiaIcons.end(); ++it) {
404 [icons_ addObject:gfx::SkBitmapToNSImage(*it)]; 404 [icons_ addObject:gfx::SkBitmapToNSImage(*it)];
405 } 405 }
406 406
407 // Default icon will be the last item in the array. 407 // Default icon will be the last item in the array.
408 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 408 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
409 // TODO(rsesek): Rename this resource now that it's in multiple places. 409 // TODO(rsesek): Rename this resource now that it's in multiple places.
410 [icons_ addObject:rb.GetNSImageNamed(IDR_BOOKMARK_BAR_FOLDER)]; 410 [icons_ addObject:rb.GetNSImageNamed(IDR_BOOKMARK_BAR_FOLDER)];
411 411
412 // Create the Cocoa model. 412 // Create the Cocoa model.
413 CookieTreeNode* root = static_cast<CookieTreeNode*>(treeModel_->GetRoot()); 413 CookieTreeNode* root = static_cast<CookieTreeNode*>(treeModel_->GetRoot());
414 scoped_nsobject<CocoaCookieTreeNode> model( 414 scoped_nsobject<CocoaCookieTreeNode> model(
415 [[CocoaCookieTreeNode alloc] initWithNode:root]); 415 [[CocoaCookieTreeNode alloc] initWithNode:root]);
416 [self setCocoaTreeModel:model.get()]; // Takes ownership. 416 [self setCocoaTreeModel:model.get()]; // Takes ownership.
417 } 417 }
418 418
419 @end 419 @end
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_remover.cc ('k') | chrome/browser/cocoa/cookies_window_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698