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

Side by Side Diff: chrome/browser/sync/glue/session_model_associator.h

Issue 10917231: Revamp TabNavigation class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac Created 8 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 | 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 #ifndef CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 // if no page is found to be referring to the favicon anymore. 415 // if no page is found to be referring to the favicon anymore.
416 void DecrementAndCleanFaviconForURL(const std::string& page_url); 416 void DecrementAndCleanFaviconForURL(const std::string& page_url);
417 417
418 // Helper method to build sync's tab specifics from a newly modified 418 // Helper method to build sync's tab specifics from a newly modified
419 // tab, window, and the locally stored previous tab data. After completing, 419 // tab, window, and the locally stored previous tab data. After completing,
420 // |prev_tab| will be updated to reflect the current data, |sync_tab| will 420 // |prev_tab| will be updated to reflect the current data, |sync_tab| will
421 // be filled with the tab data (preserving old timestamps as necessary), and 421 // be filled with the tab data (preserving old timestamps as necessary), and
422 // |new_url| will be the tab's current url. 422 // |new_url| will be the tab's current url.
423 void AssociateTabContents(const SyncedWindowDelegate& window, 423 void AssociateTabContents(const SyncedWindowDelegate& window,
424 const SyncedTabDelegate& new_tab, 424 const SyncedTabDelegate& new_tab,
425 SyncedSessionTab* prev_tab, 425 SessionTab* prev_tab,
426 sync_pb::SessionTab* sync_tab, 426 sync_pb::SessionTab* sync_tab,
427 GURL* new_url); 427 GURL* new_url);
428 428
429 // Load the favicon for the tab specified by |tab_link|. Will cancel any 429 // Load the favicon for the tab specified by |tab_link|. Will cancel any
430 // outstanding request for this tab. OnFaviconDataAvailable(..) will be called 430 // outstanding request for this tab. OnFaviconDataAvailable(..) will be called
431 // when the load completes. 431 // when the load completes.
432 void LoadFaviconForTab(TabLink* tab_link); 432 void LoadFaviconForTab(TabLink* tab_link);
433 433
434 // Callback method to store a tab's favicon into its sync node once it becomes 434 // Callback method to store a tab's favicon into its sync node once it becomes
435 // available. Does nothing if no favicon data was available. 435 // available. Does nothing if no favicon data was available.
(...skipping 13 matching lines...) Expand all
449 static void PopulateSessionWindowFromSpecifics( 449 static void PopulateSessionWindowFromSpecifics(
450 const std::string& foreign_session_tag, 450 const std::string& foreign_session_tag,
451 const sync_pb::SessionWindow& window, 451 const sync_pb::SessionWindow& window,
452 const base::Time& mtime, 452 const base::Time& mtime,
453 SessionWindow* session_window, 453 SessionWindow* session_window,
454 SyncedSessionTracker* tracker); 454 SyncedSessionTracker* tracker);
455 455
456 // Used to populate a session tab from the session specifics tab provided. 456 // Used to populate a session tab from the session specifics tab provided.
457 static void PopulateSessionTabFromSpecifics(const sync_pb::SessionTab& tab, 457 static void PopulateSessionTabFromSpecifics(const sync_pb::SessionTab& tab,
458 const base::Time& mtime, 458 const base::Time& mtime,
459 SyncedSessionTab* session_tab); 459 SessionTab* session_tab);
460 460
461 // Helper method to load the favicon data from the tab specifics. If the 461 // Helper method to load the favicon data from the tab specifics. If the
462 // favicon is valid, stores the favicon data and increments the usage counter 462 // favicon is valid, stores the favicon data and increments the usage counter
463 // in |synced_favicons_| and updates |synced_favicon_pages_| appropriately. 463 // in |synced_favicons_| and updates |synced_favicon_pages_| appropriately.
464 void LoadForeignTabFavicon(const sync_pb::SessionTab& tab); 464 void LoadForeignTabFavicon(const sync_pb::SessionTab& tab);
465 465
466 // Append a new navigation from sync specifics onto |tab| navigation vectors.
467 static void AppendSessionTabNavigation(
468 const sync_pb::TabNavigation& navigation,
469 SyncedSessionTab* tab);
470
471 // Populates the navigation portion of the session specifics.
472 static void PopulateSessionSpecificsNavigation(
473 const content::NavigationEntry& navigation,
474 sync_pb::TabNavigation* tab_navigation);
475
476 // Returns true if this tab belongs to this profile and belongs to a window, 466 // Returns true if this tab belongs to this profile and belongs to a window,
477 // false otherwise. 467 // false otherwise.
478 bool IsValidTab(const SyncedTabDelegate& tab) const; 468 bool IsValidTab(const SyncedTabDelegate& tab) const;
479 469
480 // Having a valid entry is defined as the url being valid and and having a 470 // Having a valid entry is defined as the url being valid and and having a
481 // syncable scheme (non chrome:// and file:// url's). In other words, we don't 471 // syncable scheme (non chrome:// and file:// url's). In other words, we don't
482 // want to sync a tab that is nothing but chrome:// and file:// navigations or 472 // want to sync a tab that is nothing but chrome:// and file:// navigations or
483 // invalid url's. 473 // invalid url's.
484 bool TabHasValidEntry(const SyncedTabDelegate& tab) const; 474 bool TabHasValidEntry(const SyncedTabDelegate& tab) const;
485 475
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 std::map<std::string, linked_ptr<SyncedFaviconInfo> > synced_favicons_; 549 std::map<std::string, linked_ptr<SyncedFaviconInfo> > synced_favicons_;
560 // Map of page URL -> favicon url. 550 // Map of page URL -> favicon url.
561 std::map<std::string, std::string> synced_favicon_pages_; 551 std::map<std::string, std::string> synced_favicon_pages_;
562 552
563 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); 553 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator);
564 }; 554 };
565 555
566 } // namespace browser_sync 556 } // namespace browser_sync
567 557
568 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ 558 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/sessions/tab_restore_service_browsertest.cc ('k') | chrome/browser/sync/glue/session_model_associator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698