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

Side by Side Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 8253002: Move PageTransition into content namespace. While I'm touching all these files, I've also updated... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_tabs_module.h" 5 #include "chrome/browser/extensions/extension_tabs_module.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 new_window = Browser::CreateForType(window_type, window_profile); 436 new_window = Browser::CreateForType(window_type, window_profile);
437 new_window->window()->SetBounds(window_bounds); 437 new_window->window()->SetBounds(window_bounds);
438 } else { 438 } else {
439 new_window = Browser::CreateForApp( 439 new_window = Browser::CreateForApp(
440 window_type, 440 window_type,
441 web_app::GenerateApplicationNameFromExtensionId(extension_id), 441 web_app::GenerateApplicationNameFromExtensionId(extension_id),
442 (window_type == Browser::TYPE_PANEL ? panel_bounds : popup_bounds), 442 (window_type == Browser::TYPE_PANEL ? panel_bounds : popup_bounds),
443 window_profile); 443 window_profile);
444 } 444 }
445 for (std::vector<GURL>::iterator i = urls.begin(); i != urls.end(); ++i) 445 for (std::vector<GURL>::iterator i = urls.begin(); i != urls.end(); ++i)
446 new_window->AddSelectedTabWithURL(*i, PageTransition::LINK); 446 new_window->AddSelectedTabWithURL(*i, content::PAGE_TRANSITION_LINK);
447 if (contents) { 447 if (contents) {
448 TabStripModel* target_tab_strip = new_window->tabstrip_model(); 448 TabStripModel* target_tab_strip = new_window->tabstrip_model();
449 target_tab_strip->InsertTabContentsAt(urls.size(), contents, 449 target_tab_strip->InsertTabContentsAt(urls.size(), contents,
450 TabStripModel::ADD_NONE); 450 TabStripModel::ADD_NONE);
451 } else if (urls.empty()) { 451 } else if (urls.empty()) {
452 new_window->NewTab(); 452 new_window->NewTab();
453 } 453 }
454 new_window->SelectNumberedTab(0); 454 new_window->SelectNumberedTab(0);
455 455
456 if (focused) 456 if (focused)
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 785
786 TabStripModel* tab_strip = browser->tabstrip_model(); 786 TabStripModel* tab_strip = browser->tabstrip_model();
787 787
788 index = std::min(std::max(index, -1), tab_strip->count()); 788 index = std::min(std::max(index, -1), tab_strip->count());
789 789
790 int add_types = active ? TabStripModel::ADD_ACTIVE : 790 int add_types = active ? TabStripModel::ADD_ACTIVE :
791 TabStripModel::ADD_NONE; 791 TabStripModel::ADD_NONE;
792 add_types |= TabStripModel::ADD_FORCE_INDEX; 792 add_types |= TabStripModel::ADD_FORCE_INDEX;
793 if (pinned) 793 if (pinned)
794 add_types |= TabStripModel::ADD_PINNED; 794 add_types |= TabStripModel::ADD_PINNED;
795 browser::NavigateParams params(browser, url, PageTransition::LINK); 795 browser::NavigateParams params(browser, url, content::PAGE_TRANSITION_LINK);
796 params.disposition = active ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; 796 params.disposition = active ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB;
797 params.tabstrip_index = index; 797 params.tabstrip_index = index;
798 params.tabstrip_add_types = add_types; 798 params.tabstrip_add_types = add_types;
799 browser::Navigate(&params); 799 browser::Navigate(&params);
800 800
801 if (active) 801 if (active)
802 params.target_contents->view()->SetInitialFocus(); 802 params.target_contents->view()->SetInitialFocus();
803 803
804 // Return data about the newly created tab. 804 // Return data about the newly created tab.
805 if (has_callback()) { 805 if (has_callback()) {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 render_view_host->Send( 980 render_view_host->Send(
981 new ExtensionMsg_ExecuteCode(render_view_host->routing_id(), 981 new ExtensionMsg_ExecuteCode(render_view_host->routing_id(),
982 params)); 982 params));
983 983
984 Observe(contents->tab_contents()); 984 Observe(contents->tab_contents());
985 AddRef(); // balanced in Observe() 985 AddRef(); // balanced in Observe()
986 986
987 return true; 987 return true;
988 } 988 }
989 989
990 controller.LoadURL(url, GURL(), PageTransition::LINK, std::string()); 990 controller.LoadURL(
991 url, GURL(), content::PAGE_TRANSITION_LINK, std::string());
991 992
992 // The URL of a tab contents never actually changes to a JavaScript URL, so 993 // The URL of a tab contents never actually changes to a JavaScript URL, so
993 // this check only makes sense in other cases. 994 // this check only makes sense in other cases.
994 if (!url.SchemeIs(chrome::kJavaScriptScheme)) 995 if (!url.SchemeIs(chrome::kJavaScriptScheme))
995 DCHECK_EQ(url.spec(), contents->tab_contents()->GetURL().spec()); 996 DCHECK_EQ(url.spec(), contents->tab_contents()->GetURL().spec());
996 } 997 }
997 998
998 bool active = false; 999 bool active = false;
999 // TODO(rafaelw): Setting |active| from js doesn't make much sense. 1000 // TODO(rafaelw): Setting |active| from js doesn't make much sense.
1000 // Move tab selection management up to window. 1001 // Move tab selection management up to window.
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 if (!GetTabById(tab_id, profile(), include_incognito(), 1236 if (!GetTabById(tab_id, profile(), include_incognito(),
1236 &browser, NULL, &contents, NULL, &error_)) 1237 &browser, NULL, &contents, NULL, &error_))
1237 return false; 1238 return false;
1238 } 1239 }
1239 1240
1240 TabContents* tab_contents = contents->tab_contents(); 1241 TabContents* tab_contents = contents->tab_contents();
1241 if (tab_contents->showing_interstitial_page()) { 1242 if (tab_contents->showing_interstitial_page()) {
1242 // This does as same as Browser::ReloadInternal. 1243 // This does as same as Browser::ReloadInternal.
1243 NavigationEntry* entry = tab_contents->controller().GetActiveEntry(); 1244 NavigationEntry* entry = tab_contents->controller().GetActiveEntry();
1244 GetCurrentBrowser()->OpenURL(entry->url(), GURL(), CURRENT_TAB, 1245 GetCurrentBrowser()->OpenURL(entry->url(), GURL(), CURRENT_TAB,
1245 PageTransition::RELOAD); 1246 content::PAGE_TRANSITION_RELOAD);
1246 } else if (bypass_cache) { 1247 } else if (bypass_cache) {
1247 tab_contents->controller().ReloadIgnoringCache(true); 1248 tab_contents->controller().ReloadIgnoringCache(true);
1248 } else { 1249 } else {
1249 tab_contents->controller().Reload(true); 1250 tab_contents->controller().Reload(true);
1250 } 1251 }
1251 1252
1252 return true; 1253 return true;
1253 } 1254 }
1254 1255
1255 bool RemoveTabsFunction::RunImpl() { 1256 bool RemoveTabsFunction::RunImpl() {
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 // called for every API call the extension made. 1514 // called for every API call the extension made.
1514 GotLanguage(language); 1515 GotLanguage(language);
1515 } 1516 }
1516 1517
1517 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { 1518 void DetectTabLanguageFunction::GotLanguage(const std::string& language) {
1518 result_.reset(Value::CreateStringValue(language.c_str())); 1519 result_.reset(Value::CreateStringValue(language.c_str()));
1519 SendResponse(true); 1520 SendResponse(true);
1520 1521
1521 Release(); // Balanced in Run() 1522 Release(); // Balanced in Run()
1522 } 1523 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_process_manager.cc ('k') | chrome/browser/extensions/extension_web_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698