0

Slight code change to make some global variables const.

Fix >80 cols lines.
Review URL: http://codereview.chromium.org/42013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11342 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
maruel@google.com
2009-03-10 17:39:46 +00:00
parent 9475d1d189
commit 72d1e597c8
43 changed files with 319 additions and 203 deletions

@ -157,11 +157,12 @@ def VerifyDependents(pe_name, dependents, delay_loaded, list_file, verbose):
except:
raise Error("Failed to load " + list_file)
# The dependency files have dependencies in two section - dependents and delay_loaded
# Also various distributions of Chromium can have different dependencies. So first
# we read generic dependencies ("dependents" and "delay_loaded"). If distribution
# specific dependencies exist (i.e. "dependents_google_chrome" and
# "delay_loaded_google_chrome") we use those instead.
# The dependency files have dependencies in two section - dependents and
# delay_loaded. Also various distributions of Chromium can have different
# dependencies. So first we read generic dependencies ("dependents" and
# "delay_loaded"). If distribution specific dependencies exist
# (i.e. "dependents_google_chrome" and "delay_loaded_google_chrome") we use
# those instead.
distribution = DIST_DEFAULT
if DIST_ENV_VAR in os.environ.keys():
distribution = os.environ[DIST_ENV_VAR].lower()
@ -222,4 +223,3 @@ if '__main__' == __name__:
if len(args) != 2:
option_parser.error("Incorrect number of arguments")
sys.exit(main(options, args))

@ -80,9 +80,10 @@ class CrashService {
static void OnClientConnected(void* context,
const google_breakpad::ClientInfo* client_info);
static void OnClientDumpRequest(void* context,
const google_breakpad::ClientInfo* client_info,
const std::wstring* file_path);
static void OnClientDumpRequest(
void* context,
const google_breakpad::ClientInfo* client_info,
const std::wstring* file_path);
static void OnClientExited(void* context,
const google_breakpad::ClientInfo* client_info);

@ -120,8 +120,8 @@ void InsertURLBatch(const std::wstring& profile_dir, int page_id,
PageTransition::Type transition = PageTransition::TYPED;
const int end_page_id = page_id + batch_size;
for (; page_id < end_page_id; ++page_id) {
// Randomly decide whether this new URL simulates following a link or whether
// it's a jump to a new URL.
// Randomly decide whether this new URL simulates following a link or
// whether it's a jump to a new URL.
if (!previous_url.is_empty() && RandomFloat() < kFollowLinkProbability) {
transition = PageTransition::LINK;
} else {

@ -221,7 +221,8 @@ class BitmapScrollBarThumb : public View {
// Returns the bitmap that is rendered in the middle of the thumb
// transparently over the background bitmap.
SkBitmap* grippy_bitmap() const {
return scroll_bar_->images_[BitmapScrollBar::THUMB_GRIPPY][BaseButton::BS_NORMAL];
return scroll_bar_->images_[BitmapScrollBar::THUMB_GRIPPY]
[BaseButton::BS_NORMAL];
}
// Update our state and schedule a repaint when the mouse moves over us.

@ -45,15 +45,22 @@ class BitmapScrollBar : public ScrollBar,
// A list of parts that the user may supply bitmaps for.
enum ScrollBarPart {
PREV_BUTTON = 0, // The button used to represent scrolling up/left by 1 line.
NEXT_BUTTON, // The button used to represent scrolling down/right by 1 line.
// IMPORTANT: The code assumes the prev and next
// buttons have equal width and equal height.
THUMB_START_CAP, // The top/left segment of the thumb on the scrollbar.
THUMB_MIDDLE, // The tiled background image of the thumb.
THUMB_END_CAP, // The bottom/right segment of the thumb on the scrollbar.
THUMB_GRIPPY, // The grippy that is rendered in the center of the thumb.
THUMB_TRACK, // The tiled background image of the thumb track.
// The button used to represent scrolling up/left by 1 line.
PREV_BUTTON = 0,
// The button used to represent scrolling down/right by 1 line.
// IMPORTANT: The code assumes the prev and next
// buttons have equal width and equal height.
NEXT_BUTTON,
// The top/left segment of the thumb on the scrollbar.
THUMB_START_CAP,
// The tiled background image of the thumb.
THUMB_MIDDLE,
// The bottom/right segment of the thumb on the scrollbar.
THUMB_END_CAP,
// The grippy that is rendered in the center of the thumb.
THUMB_GRIPPY,
// The tiled background image of the thumb track.
THUMB_TRACK,
PART_COUNT
};

@ -1428,7 +1428,8 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) {
height() };
gutter_bounds.right = gutter_bounds.left + gutter_width;
AdjustBoundsForRTLUI(&gutter_bounds);
NativeTheme::instance()->PaintMenuGutter(dc, MENU_POPUPGUTTER, MPI_NORMAL, &gutter_bounds);
NativeTheme::instance()->PaintMenuGutter(dc, MENU_POPUPGUTTER, MPI_NORMAL,
&gutter_bounds);
}
// Render the background.
@ -1474,7 +1475,8 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) {
int default_sys_color = render_selection ? COLOR_HIGHLIGHTTEXT :
(IsEnabled() ? COLOR_MENUTEXT : COLOR_GRAYTEXT);
SkColor fg_color = NativeTheme::instance()->GetThemeColorWithDefault(
NativeTheme::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR, default_sys_color);
NativeTheme::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR,
default_sys_color);
int width = this->width() - item_right_margin - label_start;
ChromeFont& font = GetRootMenuItem()->font_;
gfx::Rect text_bounds(label_start, top_margin, width, font.height());
@ -1506,8 +1508,12 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) {
if (HasSubmenu()) {
int state_id = IsEnabled() ? MSM_NORMAL : MSM_DISABLED;
RECT arrow_bounds = { this->width() - item_right_margin + kLabelToArrowPadding,
0, 0, height() };
RECT arrow_bounds = {
this->width() - item_right_margin + kLabelToArrowPadding,
0,
0,
height()
};
arrow_bounds.right = arrow_bounds.left + arrow_width;
AdjustBoundsForRTLUI(&arrow_bounds);

@ -51,8 +51,8 @@ gfx::Size ComboBox::GetPreferredSize() {
// to the corner of rcItem. It does not seem to be queryable from the theme.
// It is consistent on all versions of Windows from 2K to Vista, and is
// invariant with respect to the combobox border size. We could conceivably
// get this number from rect_item.x, but it seems fragile to depend on position
// here, inside of the layout code.
// get this number from rect_item.x, but it seems fragile to depend on
// position here, inside of the layout code.
const int kItemOffset = 3;
int item_to_button_distance = std::max(kItemOffset - border.width(), 0);

@ -79,7 +79,8 @@ MouseEvent::MouseEvent(const MouseEvent& model, View* from, View* to)
int KeyEvent::GetKeyStateFlags() const {
// Windows Keyboard messages don't come with control key state as parameters
// like mouse messages do, so we need to explicitly probe for these key states.
// like mouse messages do, so we need to explicitly probe for these key
// states.
int flags = 0;
if (GetKeyState(VK_MENU) & 0x80)
flags |= Event::EF_ALT_DOWN;

@ -136,7 +136,7 @@ class GridLayout : public LayoutManager {
// As a convenience this adds the view to the host. The view becomes owned
// by the host, and NOT this GridLayout.
void AddView(View* view, int col_span, int row_span, Alignment h_align,
Alignment v_align);
Alignment v_align);
// Adds a view with the specified alignment and spans. If
// pref_width/pref_height is > 0 then the preferred width/height of the view

@ -387,9 +387,11 @@ TEST_F(GridLayoutTest, FixedSize) {
for (int i = 0; i < column_count; ++i) {
for (int row = 0; row < row_count; ++row) {
View* view = host.GetChildViewAt(row * column_count + i);
ExpectViewBoundsEquals(2 + title_width * i + (title_width - pref_width) / 2,
2 + pref_height * row,
pref_width, pref_height, view);
ExpectViewBoundsEquals(
2 + title_width * i + (title_width - pref_width) / 2,
2 + pref_height * row,
pref_width,
pref_height, view);
}
}

@ -139,8 +139,8 @@ class Label : public View {
// it is returned instead.
virtual bool GetTooltipText(int x, int y, std::wstring* tooltip);
// Mouse enter/exit are overridden to render mouse over background color. These
// invoke SetContainsMouse as necessary.
// Mouse enter/exit are overridden to render mouse over background color.
// These invoke SetContainsMouse as necessary.
virtual void OnMouseMoved(const MouseEvent& e);
virtual void OnMouseEntered(const MouseEvent& event);
virtual void OnMouseExited(const MouseEvent& event);

@ -248,7 +248,9 @@ gfx::Size NativeScrollBar::GetPreferredSize() {
return gfx::Size(GetLayoutSize(), 0);
}
void NativeScrollBar::Update(int viewport_size, int content_size, int current_pos) {
void NativeScrollBar::Update(int viewport_size,
int content_size,
int current_pos) {
ScrollBar::Update(viewport_size, content_size, current_pos);
if (!sb_container_)
return;

@ -81,10 +81,10 @@ class ImagePainter : public Painter {
DISALLOW_EVIL_CONSTRUCTORS(ImagePainter);
};
// HorizontalPainter paints 3 images into a box: left, center and right. The left
// and right images are drawn to size at the left/right edges of the region.
// The center is tiled in the remaining space. All images must have the same
// height.
// HorizontalPainter paints 3 images into a box: left, center and right. The
// left and right images are drawn to size at the left/right edges of the
// region. The center is tiled in the remaining space. All images must have the
// same height.
class HorizontalPainter : public Painter {
public:
// Constructs a new HorizontalPainter loading the specified image names.

@ -86,40 +86,55 @@ void TextButtonBorder::Paint(const View& view, ChromeCanvas* canvas) const {
canvas->DrawBitmapInt(*set->top_left, 0, 0);
// Tile the top image
canvas->TileImageInt(*set->top,
set->top_left->width(), 0,
bounds.width() - set->top_right->width() - set->top_left->width(),
set->top->height());
canvas->TileImageInt(
*set->top,
set->top_left->width(),
0,
bounds.width() - set->top_right->width() - set->top_left->width(),
set->top->height());
// Draw the top right image
canvas->DrawBitmapInt(*set->top_right,
bounds.width() - set->top_right->width(), 0);
// Tile the left image
canvas->TileImageInt(*set->left,
0, set->top_left->height(),
set->top_left->width(),
bounds.height() - set->top->height() - set->bottom_left->height());
canvas->TileImageInt(
*set->left,
0,
set->top_left->height(),
set->top_left->width(),
bounds.height() - set->top->height() - set->bottom_left->height());
// Tile the center image
canvas->TileImageInt(*set->center,
set->left->width(), set->top->height(),
bounds.width() - set->right->width() - set->left->width(),
bounds.height() - set->bottom->height() - set->top->height());
canvas->TileImageInt(
*set->center,
set->left->width(),
set->top->height(),
bounds.width() - set->right->width() - set->left->width(),
bounds.height() - set->bottom->height() - set->top->height());
// Tile the right image
canvas->TileImageInt(*set->right,
bounds.width() - set->right->width(), set->top_right->height(),
bounds.width(), bounds.height() - set->bottom_right->height() - set->top_right->height());
canvas->TileImageInt(
*set->right,
bounds.width() - set->right->width(),
set->top_right->height(),
bounds.width(),
bounds.height() - set->bottom_right->height() -
set->top_right->height());
// Draw the bottom left image
canvas->DrawBitmapInt(*set->bottom_left, 0, bounds.height() - set->bottom_left->height());
canvas->DrawBitmapInt(*set->bottom_left,
0,
bounds.height() - set->bottom_left->height());
// Tile the bottom image
canvas->TileImageInt(*set->bottom,
set->bottom_left->width(), bounds.height() - set->bottom->height(),
bounds.width() - set->bottom_right->width() - set->bottom_left->width(),
set->bottom->height());
canvas->TileImageInt(
*set->bottom,
set->bottom_left->width(),
bounds.height() - set->bottom->height(),
bounds.width() - set->bottom_right->width() -
set->bottom_left->width(),
set->bottom->height());
// Draw the bottom right image
canvas->DrawBitmapInt(*set->bottom_right,

@ -290,7 +290,8 @@ void TooltipManager::TrimTooltipToFit(std::wstring* text,
gfx::Point screen_loc(position_x, position_y);
View::ConvertPointToScreen(widget_->GetRootView(), &screen_loc);
gfx::Rect monitor_bounds =
win_util::GetMonitorBoundsForRect(gfx::Rect(screen_loc.x(), screen_loc.y(),
win_util::GetMonitorBoundsForRect(gfx::Rect(screen_loc.x(),
screen_loc.y(),
0, 0));
RECT tooltip_margin;
SendMessage(window, TTM_GETMARGIN, 0, (LPARAM)&tooltip_margin);

@ -408,8 +408,14 @@ class WidgetWin : public Widget,
virtual LRESULT OnMouseWheel(UINT flags, short distance, const CPoint& point);
virtual LRESULT OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param);
virtual LRESULT OnNCActivate(BOOL active) { SetMsgHandled(FALSE); return 0; }
virtual LRESULT OnNCCalcSize(BOOL w_param, LPARAM l_param) { SetMsgHandled(FALSE); return 0; }
virtual LRESULT OnNCHitTest(const CPoint& pt) { SetMsgHandled(FALSE); return 0; }
virtual LRESULT OnNCCalcSize(BOOL w_param, LPARAM l_param) {
SetMsgHandled(FALSE);
return 0;
}
virtual LRESULT OnNCHitTest(const CPoint& pt) {
SetMsgHandled(FALSE);
return 0;
}
virtual void OnNCLButtonDblClk(UINT flags, const CPoint& point);
virtual void OnNCLButtonDown(UINT flags, const CPoint& point);
virtual void OnNCLButtonUp(UINT flags, const CPoint& point);

@ -233,7 +233,8 @@ void Window::UpdateWindowTitle() {
}
void Window::UpdateWindowIcon() {
// If the non-client view is rendering its own icon, we need to tell it to repaint.
// If the non-client view is rendering its own icon, we need to tell it to
// repaint.
non_client_view_->SchedulePaint();
// Update the native frame's icon. We do this regardless of whether or not
@ -697,18 +698,18 @@ void Window::OnNCLButtonDown(UINT ht_component, const CPoint& point) {
case HTCLOSE:
case HTMINBUTTON:
case HTMAXBUTTON: {
// When the mouse is pressed down in these specific non-client areas, we
// need to tell the RootView to send the mouse pressed event (which sets
// capture, allowing subsequent WM_LBUTTONUP (note, _not_ WM_NCLBUTTONUP)
// to fire so that the appropriate WM_SYSCOMMAND can be sent by the
// applicable button's ButtonListener. We _have_ to do this this way
// rather than letting Windows just send the syscommand itself (as would
// happen if we never did this dance) because for some insane reason
// DefWindowProc for WM_NCLBUTTONDOWN also renders the pressed window
// control button appearance, in the Windows classic style, over our
// view! Ick! By handling this message we prevent Windows from doing this
// undesirable thing, but that means we need to roll the sys-command
// handling ourselves.
// When the mouse is pressed down in these specific non-client areas,
// we need to tell the RootView to send the mouse pressed event (which
// sets capture, allowing subsequent WM_LBUTTONUP (note, _not_
// WM_NCLBUTTONUP) to fire so that the appropriate WM_SYSCOMMAND can be
// sent by the applicable button's ButtonListener. We _have_ to do this
// way rather than letting Windows just send the syscommand itself (as
// would happen if we never did this dance) because for some insane
// reason DefWindowProc for WM_NCLBUTTONDOWN also renders the pressed
// window control button appearance, in the Windows classic style, over
// our view! Ick! By handling this message we prevent Windows from
// doing this undesirable thing, but that means we need to roll the
// sys-command handling ourselves.
ProcessNCMousePress(point, MK_LBUTTON);
return;
}

@ -47,7 +47,8 @@ void WebWorkerClientProxy::PostConsoleMessageToWorkerObject(
route_id_, destination, source, level,message, line_number, source_url));
}
void WebWorkerClientProxy::ConfirmMessageFromWorkerObject(bool has_pending_activity) {
void WebWorkerClientProxy::ConfirmMessageFromWorkerObject(
bool has_pending_activity) {
Send(new WorkerHostMsg_ConfirmMessageFromWorkerObject(
route_id_, has_pending_activity));
}

@ -12,7 +12,8 @@
#include "WebKit.h"
WorkerThread::WorkerThread()
: ChildThread(base::Thread::Options(MessageLoop::TYPE_DEFAULT, kV8StackSize)) {
: ChildThread(base::Thread::Options(MessageLoop::TYPE_DEFAULT,
kV8StackSize)) {
}
WorkerThread::~WorkerThread() {

@ -19,7 +19,8 @@ class CompletionCallbackImpl :
public CallbackImpl< T, void (T::*)(int), Tuple1<int> > {
public:
CompletionCallbackImpl(T* obj, void (T::* meth)(int))
: CallbackImpl< T, void (T::*)(int), Tuple1<int> >::CallbackImpl(obj, meth) {
: CallbackImpl< T, void (T::*)(int),
Tuple1<int> >::CallbackImpl(obj, meth) {
}
};
@ -56,4 +57,3 @@ class CancelableCompletionCallback :
} // namespace net
#endif // NET_BASE_COMPLETION_CALLBACK_H__

@ -31,8 +31,8 @@ bool CookiePolicy::CanSetCookie(const GURL& url, const GURL& policy_url) {
case CookiePolicy::BLOCK_THIRD_PARTY_COOKIES:
if (policy_url.is_empty())
return true; // Empty policy URL should indicate a first-party request
return net::RegistryControlledDomainService::SameDomainOrHost(url, policy_url);
return net::RegistryControlledDomainService::SameDomainOrHost(url,
policy_url);
case CookiePolicy::BLOCK_ALL_COOKIES:
return false;
default:
@ -45,4 +45,3 @@ CookiePolicy::CookiePolicy() : type_(CookiePolicy::ALLOW_ALL_COOKIES) {
}
} // namespace net

@ -72,7 +72,8 @@ TEST(DataURLTest, Parse) {
"kk",
"boo" },
{ "data:text/html,%3Chtml%3E%3Cbody%3E%3Cb%3Ehello%20world%3C%2Fb%3E%3C%2Fbody%3E%3C%2Fhtml%3E",
{ "data:text/html,%3Chtml%3E%3Cbody%3E%3Cb%3Ehello%20world"
"%3C%2Fb%3E%3C%2Fbody%3E%3C%2Fhtml%3E",
true,
"text/html",
"US-ASCII",
@ -123,7 +124,8 @@ TEST(DataURLTest, Parse) {
// In base64 encoding, escaped whitespace should be stripped.
// (This test was taken from acid3)
// http://b/1054495
{ "data:text/javascript;base64,%20ZD%20Qg%0D%0APS%20An%20Zm91cic%0D%0A%207%20",
{ "data:text/javascript;base64,%20ZD%20Qg%0D%0APS%20An%20Zm91cic%0D%0A%207"
"%20",
true,
"text/javascript",
"US-ASCII",
@ -154,4 +156,3 @@ TEST(DataURLTest, Parse) {
}
}
}

@ -115,18 +115,28 @@ TEST(Escape, UnescapeURLComponent) {
{"%%%%%%", UnescapeRule::NORMAL, "%%%%%%"},
{"Don't escape anything", UnescapeRule::NORMAL, "Don't escape anything"},
{"Invalid %escape %2", UnescapeRule::NORMAL, "Invalid %escape %2"},
{"Some%20random text %25%3bOK", UnescapeRule::NORMAL, "Some%20random text %25;OK"},
{"Some%20random text %25%3bOK", UnescapeRule::SPACES, "Some random text %25;OK"},
{"Some%20random text %25%3bOK", UnescapeRule::URL_SPECIAL_CHARS, "Some%20random text %;OK"},
{"Some%20random text %25%3bOK", UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS, "Some random text %;OK"},
{"Some%20random text %25%3bOK", UnescapeRule::NORMAL,
"Some%20random text %25;OK"},
{"Some%20random text %25%3bOK", UnescapeRule::SPACES,
"Some random text %25;OK"},
{"Some%20random text %25%3bOK", UnescapeRule::URL_SPECIAL_CHARS,
"Some%20random text %;OK"},
{"Some%20random text %25%3bOK",
UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS,
"Some random text %;OK"},
{"%A0%B1%C2%D3%E4%F5", UnescapeRule::NORMAL, "\xA0\xB1\xC2\xD3\xE4\xF5"},
{"%Aa%Bb%Cc%Dd%Ee%Ff", UnescapeRule::NORMAL, "\xAa\xBb\xCc\xDd\xEe\xFf"},
// Certain URL-sensitive characters should not be unescaped unless asked.
{"Hello%20%13%10world %23# %3F? %3D= %26& %25% %2B+", UnescapeRule::SPACES, "Hello %13%10world %23# %3F? %3D= %26& %25% %2B+"},
{"Hello%20%13%10world %23# %3F? %3D= %26& %25% %2B+", UnescapeRule::URL_SPECIAL_CHARS, "Hello%20%13%10world ## ?? == && %% ++"},
{"Hello%20%13%10world %23# %3F? %3D= %26& %25% %2B+", UnescapeRule::SPACES,
"Hello %13%10world %23# %3F? %3D= %26& %25% %2B+"},
{"Hello%20%13%10world %23# %3F? %3D= %26& %25% %2B+",
UnescapeRule::URL_SPECIAL_CHARS,
"Hello%20%13%10world ## ?? == && %% ++"},
// Control characters.
{"%01%02%03%04%05%06%07%08%09 %25", UnescapeRule::URL_SPECIAL_CHARS, "%01%02%03%04%05%06%07%08%09 %"},
{"%01%02%03%04%05%06%07%08%09 %25", UnescapeRule::CONTROL_CHARS, "\x01\x02\x03\x04\x05\x06\x07\x08\x09 %25"},
{"%01%02%03%04%05%06%07%08%09 %25", UnescapeRule::URL_SPECIAL_CHARS,
"%01%02%03%04%05%06%07%08%09 %"},
{"%01%02%03%04%05%06%07%08%09 %25", UnescapeRule::CONTROL_CHARS,
"\x01\x02\x03\x04\x05\x06\x07\x08\x09 %25"},
{"Hello%20%13%10%02", UnescapeRule::SPACES, "Hello %13%10%02"},
{"Hello%20%13%10%02", UnescapeRule::CONTROL_CHARS, "Hello%20\x13\x10\x02"},
};
@ -221,5 +231,3 @@ TEST(Escape, EscapeForHTML) {
EXPECT_EQ(std::string(tests[i].expected_output), result);
}
}

@ -332,7 +332,8 @@ static bool SniffXML(const char* content, size_t size, std::string* result) {
// Skip XML declarations.
++pos;
continue;
} else if (base::strncasecmp(pos, "<!DOCTYPE", sizeof("<!DOCTYPE")-1) == 0) {
} else if (base::strncasecmp(pos, "<!DOCTYPE",
sizeof("<!DOCTYPE")-1) == 0) {
// Skip DOCTYPE declarations.
++pos;
continue;

@ -155,7 +155,7 @@ bool MimeUtil::GetMimeTypeFromFile(const FilePath& file_path,
// From WebKit's WebCore/platform/MIMETypeRegistry.cpp:
static const char* supported_image_types[] = {
static const char* const supported_image_types[] = {
"image/jpeg",
"image/jpg",
"image/png",
@ -166,7 +166,7 @@ static const char* supported_image_types[] = {
};
// Note: does not include javascript types list (see supported_javascript_types)
static const char* supported_non_image_types[] = {
static const char* const supported_non_image_types[] = {
"text/html",
"text/xml",
"text/xsl",
@ -181,12 +181,16 @@ static const char* supported_non_image_types[] = {
};
// Mozilla 1.8 and WinIE 7 both accept text/javascript and text/ecmascript.
// Mozilla 1.8 accepts application/javascript, application/ecmascript, and application/x-javascript, but WinIE 7 doesn't.
// WinIE 7 accepts text/javascript1.1 - text/javascript1.3, text/jscript, and text/livescript, but Mozilla 1.8 doesn't.
// Mozilla 1.8 accepts application/javascript, application/ecmascript, and
// application/x-javascript, but WinIE 7 doesn't.
// WinIE 7 accepts text/javascript1.1 - text/javascript1.3, text/jscript, and
// text/livescript, but Mozilla 1.8 doesn't.
// Mozilla 1.8 allows leading and trailing whitespace, but WinIE 7 doesn't.
// Mozilla 1.8 and WinIE 7 both accept the empty string, but neither accept a whitespace-only string.
// We want to accept all the values that either of these browsers accept, but not other values.
static const char* supported_javascript_types[] = {
// Mozilla 1.8 and WinIE 7 both accept the empty string, but neither accept a
// whitespace-only string.
// We want to accept all the values that either of these browsers accept, but
// not other values.
static const char* const supported_javascript_types[] = {
"text/javascript",
"text/ecmascript",
"application/javascript",
@ -199,7 +203,7 @@ static const char* supported_javascript_types[] = {
"text/livescript"
};
static const char* view_source_types[] = {
static const char* const view_source_types[] = {
"text/xml",
"text/xsl",
"application/xml",
@ -333,4 +337,3 @@ bool MatchesMimeType(const std::string &mime_type_pattern,
}
} // namespace net

@ -167,7 +167,8 @@ STR GetSpecificHeaderT(const STR& headers, const STR& name) {
// TODO(jungshik): We have almost identical hex-decoding code else where.
// Consider refactoring and moving it somewhere(base?). Bug 1224311
inline bool IsHexDigit(unsigned char c) {
return (('0' <= c && c <= '9') || ('A' <= c && c <= 'F') || ('a' <= c && c <= 'f'));
return (('0' <= c && c <= '9') || ('A' <= c && c <= 'F') ||
('a' <= c && c <= 'f'));
}
inline unsigned char HexToInt(unsigned char c) {
@ -564,7 +565,8 @@ bool IsIDNComponentSafe(const char16* str,
// rebuilt with the minimal subset of locale data for languages
// to which Chrome is not localized but which we offer in the list
// of languages selectable for Accept-Languages. With the rebuilt ICU
// data, ulocdata_open never should fall back to the default locale. (issue 2078)
// data, ulocdata_open never should fall back to the default locale.
// (issue 2078)
// DCHECK(U_SUCCESS(status) && status != U_USING_DEFAULT_WARNING);
if (U_SUCCESS(status) && status != U_USING_DEFAULT_WARNING) {
// Should we use auxiliary set, instead?

@ -116,16 +116,22 @@ TEST(NetUtilTest, FileURLConversion) {
const FileCase round_trip_cases[] = {
#if defined(OS_WIN)
{L"C:\\foo\\bar.txt", L"file:///C:/foo/bar.txt"},
{L"\\\\some computer\\foo\\bar.txt", L"file://some%20computer/foo/bar.txt"}, // UNC
{L"D:\\Name;with%some symbols*#", L"file:///D:/Name%3Bwith%25some%20symbols*%23"},
{L"D:\\Chinese\\\x6240\x6709\x4e2d\x6587\x7f51\x9875.doc", L"file:///D:/Chinese/%E6%89%80%E6%9C%89%E4%B8%AD%E6%96%87%E7%BD%91%E9%A1%B5.doc"},
{L"\\\\some computer\\foo\\bar.txt",
L"file://some%20computer/foo/bar.txt"}, // UNC
{L"D:\\Name;with%some symbols*#",
L"file:///D:/Name%3Bwith%25some%20symbols*%23"},
{L"D:\\Chinese\\\x6240\x6709\x4e2d\x6587\x7f51\x9875.doc",
L"file:///D:/Chinese/%E6%89%80%E6%9C%89%E4%B8%AD%E6%96%87%E7%BD%91"
L"%E9%A1%B5.doc"},
#elif defined(OS_POSIX)
{L"/foo/bar.txt", L"file:///foo/bar.txt"},
{L"/foo/BAR.txt", L"file:///foo/BAR.txt"},
{L"/C:/foo/bar.txt", L"file:///C:/foo/bar.txt"},
{L"/some computer/foo/bar.txt", L"file:///some%20computer/foo/bar.txt"},
{L"/Name;with%some symbols*#", L"file:///Name%3Bwith%25some%20symbols*%23"},
{L"/Chinese/\x6240\x6709\x4e2d\x6587\x7f51\x9875.doc", L"file:///Chinese/%E6%89%80%E6%9C%89%E4%B8%AD%E6%96%87%E7%BD%91%E9%A1%B5.doc"},
{L"/Chinese/\x6240\x6709\x4e2d\x6587\x7f51\x9875.doc",
L"file:///Chinese/%E6%89%80%E6%9C%89%E4%B8%AD%E6%96%87%E7%BD"
L"%91%E9%A1%B5.doc"},
#endif
};
@ -184,11 +190,14 @@ TEST(NetUtilTest, FileURLConversion) {
// Here, we test that UTF-8 encoded strings get decoded properly, even when
// they might be stored with wide characters. On posix systems, just treat
// this as a stream of bytes.
const wchar_t utf8[] = L"file:///d:/Chinese/\xe6\x89\x80\xe6\x9c\x89\xe4\xb8\xad\xe6\x96\x87\xe7\xbd\x91\xe9\xa1\xb5.doc";
const wchar_t utf8[] = L"file:///d:/Chinese/\xe6\x89\x80\xe6\x9c\x89\xe4\xb8"
L"\xad\xe6\x96\x87\xe7\xbd\x91\xe9\xa1\xb5.doc";
#if defined(OS_WIN)
const wchar_t wide[] = L"D:\\Chinese\\\x6240\x6709\x4e2d\x6587\x7f51\x9875.doc";
const wchar_t wide[] =
L"D:\\Chinese\\\x6240\x6709\x4e2d\x6587\x7f51\x9875.doc";
#elif defined(OS_POSIX)
const wchar_t wide[] = L"/d:/Chinese/\xe6\x89\x80\xe6\x9c\x89\xe4\xb8\xad\xe6\x96\x87\xe7\xbd\x91\xe9\xa1\xb5.doc";
const wchar_t wide[] = L"/d:/Chinese/\xe6\x89\x80\xe6\x9c\x89\xe4\xb8\xad\xe6"
L"\x96\x87\xe7\xbd\x91\xe9\xa1\xb5.doc";
#endif
EXPECT_TRUE(net::FileURLToFilePath(GURL(WideToUTF8(utf8)), &output));
EXPECT_EQ(std::wstring(wide), output);
@ -220,7 +229,8 @@ const wchar_t* google_headers =
L"Transfer-Encoding: chunked\n"
L"Set-Cookie: HEHE_AT=6666x66beef666x6-66xx6666x66; Path=/mail\n"
L"Set-Cookie: HEHE_HELP=owned:0;Path=/\n"
L"Set-Cookie: S=gmail=Xxx-beefbeefbeef_beefb:gmail_yj=beefbeef000beefbeefbee:gmproxy=bee-fbeefbe; Domain=.google.com; Path=/\n"
L"Set-Cookie: S=gmail=Xxx-beefbeefbeef_beefb:gmail_yj=beefbeef000beefbee"
L"fbee:gmproxy=bee-fbeefbe; Domain=.google.com; Path=/\n"
L"X-Google-Google2: /one/two/three/four/five/six/seven-height/nine:9411\n"
L"Server: GFE/1.3\n"
L"Transfer-Encoding: chunked\n"
@ -303,7 +313,8 @@ TEST(NetUtilTest, GetFileNameFromCD) {
{"content-disposition: name=abcde.pdf", L"abcde.pdf"},
{"content-disposition: inline; filename=\"abc%20de.pdf\"", L"abc de.pdf"},
// Whitespaces are converted to a space.
{"content-disposition: inline; filename=\"abc \t\nde.pdf\"", L"abc de.pdf"},
{"content-disposition: inline; filename=\"abc \t\nde.pdf\"",
L"abc de.pdf"},
// %-escaped UTF-8
{"Content-Disposition: attachment; filename=\"%EC%98%88%EC%88%A0%20"
"%EC%98%88%EC%88%A0.jpg\"", L"\xc608\xc220 \xc608\xc220.jpg"},
@ -583,8 +594,10 @@ TEST(NetUtilTest, IDNToUnicode) {
false, false, false, false, false,
false}},
// One that's really long that will force a buffer realloc
{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
L"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaa",
L"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
L"aaaaaaaa",
{true, true, true, true, true,
true, true, true, true, true,
true, true, true, true, true,
@ -775,7 +788,8 @@ TEST(NetUtilTest, GetDirectoryListingEntry) {
false,
10000,
base::Time(),
"<script>addRow(\"quo\\\"tes\",\"quo%22tes\",0,\"9.8 kB\",\"\");</script>\n"},
"<script>addRow(\"quo\\\"tes\",\"quo%22tes\",0,\"9.8 kB\",\"\");</script>"
"\n"},
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) {

@ -168,14 +168,14 @@ static int memio_buffer_put(struct memio_buffer *mb, const char *buf, int n)
transferred += len;
/* Handle part after wrap */
len = PR_MIN(n, memio_buffer_unused_contiguous(mb));
if (len > 0) {
len = PR_MIN(n, memio_buffer_unused_contiguous(mb));
if (len > 0) {
/* Output buffer still not full, input buffer still not empty */
memcpy(&mb->buf[mb->tail], buf, len);
mb->tail += len;
memcpy(&mb->buf[mb->tail], buf, len);
mb->tail += len;
if (mb->tail == mb->bufsize)
mb->tail = 0;
transferred += len;
transferred += len;
}
}
@ -201,13 +201,13 @@ static int memio_buffer_get(struct memio_buffer *mb, char *buf, int n)
transferred += len;
/* Handle part after wrap */
len = PR_MIN(n, memio_buffer_used_contiguous(mb));
if (len) {
memcpy(buf, &mb->buf[mb->head], len);
mb->head += len;
len = PR_MIN(n, memio_buffer_used_contiguous(mb));
if (len) {
memcpy(buf, &mb->buf[mb->head], len);
mb->head += len;
if (mb->head == mb->bufsize)
mb->head = 0;
transferred += len;
transferred += len;
}
}
@ -429,7 +429,7 @@ void memio_PutReadResult(memio_Private *secret, int bytes_read)
if (bytes_read > 0) {
mb->tail += bytes_read;
if (mb->tail == mb->bufsize)
mb->tail = 0;
mb->tail = 0;
} else if (bytes_read == 0) {
/* Record EOF condition and report to caller when buffer runs dry */
((PRFilePrivate *)secret)->eof = PR_TRUE;
@ -472,8 +472,8 @@ void memio_PutWriteResult(memio_Private *secret, int bytes_written)
#define CHECKEQ(a, b) { \
if ((a) != (b)) { \
printf("%d != %d, Test failed line %d\n", a, b, __LINE__); \
exit(1); \
printf("%d != %d, Test failed line %d\n", a, b, __LINE__); \
exit(1); \
} \
}

@ -400,7 +400,8 @@ int SSLClientSocketNSS::DoLoop(int last_io_result) {
int nreceived = BufferRecv();
network_moved = (nsent > 0 || nreceived >= 0);
}
} while ((rv != ERR_IO_PENDING || network_moved) && next_state_ != STATE_NONE);
} while ((rv != ERR_IO_PENDING || network_moved) &&
next_state_ != STATE_NONE);
LeaveFunction("");
return rv;
}
@ -585,4 +586,3 @@ int SSLClientSocketNSS::DoPayloadWrite() {
}
} // namespace net

@ -24,15 +24,24 @@ protected:
private:
enum TelnetInputState {
NOT_IN_IAC_OR_ESC_SEQUENCE, // Currently not processing any IAC or ESC sequence.
EXPECTING_NEW_LINE, // Received carriage return (CR) expecting new line (LF).
EXPECTING_COMMAND, // Processing IAC expecting command.
EXPECTING_OPTION, // Processing IAC expecting option.
SUBNEGOTIATION_EXPECTING_IAC, // Inside subnegoation IAC,SE will end it.
SUBNEGOTIATION_EXPECTING_SE, // Ending subnegoation expecting SE.
EXPECTING_FIRST_ESC_CHARACTER, // Processing ESC sequence.
EXPECTING_SECOND_ESC_CHARACTER, // Processing ESC sequence with two characters
EXPECTING_NUMBER_SEMICOLON_OR_END // Processing "ESC [" sequence.
// Currently not processing any IAC or ESC sequence.
NOT_IN_IAC_OR_ESC_SEQUENCE,
// Received carriage return (CR) expecting new line (LF).
EXPECTING_NEW_LINE,
// Processing IAC expecting command.
EXPECTING_COMMAND,
// Processing IAC expecting option.
EXPECTING_OPTION,
// Inside subnegoation IAC,SE will end it.
SUBNEGOTIATION_EXPECTING_IAC,
// Ending subnegoation expecting SE.
SUBNEGOTIATION_EXPECTING_SE,
// Processing ESC sequence.
EXPECTING_FIRST_ESC_CHARACTER,
// Processing ESC sequence with two characters.
EXPECTING_SECOND_ESC_CHARACTER,
// Processing "ESC [" sequence.
EXPECTING_NUMBER_SEMICOLON_OR_END
};
TelnetServer(SOCKET s, ListenSocketDelegate* del);
@ -50,4 +59,3 @@ private:
};
#endif // BASE_TELNET_SERVER_H_

@ -320,7 +320,8 @@ class HttpCache::Transaction
uint64 final_upload_progress_;
CompletionCallbackImpl<Transaction> network_info_callback_;
CompletionCallbackImpl<Transaction> network_read_callback_;
scoped_refptr<CancelableCompletionCallback<Transaction> > cache_read_callback_;
scoped_refptr<CancelableCompletionCallback<Transaction> >
cache_read_callback_;
};
HttpCache::Transaction::~Transaction() {
@ -1458,4 +1459,3 @@ void HttpCache::OnProcessPendingQueue(ActiveEntry* entry) {
//-----------------------------------------------------------------------------
} // namespace net

@ -820,7 +820,8 @@ static void ETagGet_ConditionalRequest_Handler(
std::string* response_status,
std::string* response_headers,
std::string* response_data) {
EXPECT_TRUE(request->extra_headers.find("If-None-Match") != std::string::npos);
EXPECT_TRUE(request->extra_headers.find("If-None-Match") !=
std::string::npos);
response_status->assign("HTTP/1.1 304 Not Modified");
response_headers->assign(kETagGET_Transaction.response_headers);
response_data->clear();
@ -957,7 +958,8 @@ TEST(HttpCache, RangeGET_SkipsCache) {
EXPECT_EQ(0, cache.disk_cache()->open_count());
EXPECT_EQ(0, cache.disk_cache()->create_count());
transaction.request_headers = "If-Modified-Since: Wed, 28 Nov 2007 00:45:20 GMT";
transaction.request_headers =
"If-Modified-Since: Wed, 28 Nov 2007 00:45:20 GMT";
RunTransactionTest(cache.http_cache(), transaction);
EXPECT_EQ(3, cache.network_layer()->transaction_count());

@ -32,7 +32,9 @@ void RunTest(const char* inputs[], size_t num_inputs,
}
// Feed the inputs to the decoder, until it returns an error.
void RunTestUntilFailure(const char* inputs[], size_t num_inputs, size_t fail_index) {
void RunTestUntilFailure(const char* inputs[],
size_t num_inputs,
size_t fail_index) {
net::HttpChunkedDecoder decoder;
EXPECT_FALSE(decoder.reached_eof());
@ -264,4 +266,3 @@ TEST(HttpChunkedDecoderTest, InvalidConsecutiveCRLFs) {
};
RunTestUntilFailure(inputs, arraysize(inputs), 1);
}

@ -226,8 +226,8 @@ class HttpResponseHeaders :
std::string::const_iterator line_end);
// Tries to extract the status line from a header block, given the first
// line of said header block. If the status line is malformed, we'll construct
// a valid one. Example input:
// line of said header block. If the status line is malformed, we'll
// construct a valid one. Example input:
// HTTP/1.1 200 OK
// with line_begin and end pointing at the begin and end of this line.
// Output will be a normalized version of this, with a trailing \n.

@ -636,7 +636,8 @@ TEST(HttpResponseHeadersTest, GetMimeType) {
for (size_t i = 0; i < arraysize(tests); ++i) {
string headers(tests[i].raw_headers);
HeadersToRaw(&headers);
scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers);
scoped_refptr<HttpResponseHeaders> parsed =
new HttpResponseHeaders(headers);
std::string value;
EXPECT_EQ(tests[i].has_mimetype, parsed->GetMimeType(&value));
@ -762,7 +763,8 @@ TEST(HttpResponseHeadersTest, RequiresValidation) {
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
string headers(tests[i].headers);
HeadersToRaw(&headers);
scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers);
scoped_refptr<HttpResponseHeaders> parsed =
new HttpResponseHeaders(headers);
bool requires_validation =
parsed->RequiresValidation(request_time, response_time, current_time);

@ -343,7 +343,8 @@ class MockProxyScriptFetcher : public net::ProxyScriptFetcher {
std::string* pending_request_bytes_;
};
// Template specialization so MockProxyScriptFetcher does not have to be refcounted.
// Template specialization so MockProxyScriptFetcher does not have to be
// refcounted.
template<>
void RunnableMethodTraits<MockProxyScriptFetcher>::RetainCallee(
MockProxyScriptFetcher* remover) {}
@ -922,4 +923,3 @@ TEST(ProxyServiceTest, CancelWhilePACFetching) {
EXPECT_EQ("pac-v1.request3:80",
result3->GetProxyInfo().proxy_server().ToURI());
}

@ -120,10 +120,16 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.EchoAllHandler,
self.EchoHandler] + self._get_handlers
self._mime_types = { 'gif': 'image/gif', 'jpeg' : 'image/jpeg', 'jpg' : 'image/jpeg' }
self._mime_types = {
'gif': 'image/gif',
'jpeg' : 'image/jpeg',
'jpg' : 'image/jpeg'
}
self._default_mime_type = 'text/html'
BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, request, client_address, socket_server)
BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, request,
client_address,
socket_server)
def _ShouldHandleRequest(self, handler_name):
"""Determines if the path can be handled by the handler.
@ -174,7 +180,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
self.wfile.write('<html><head><title>%s</title></head></html>' %
time.time())
return True
@ -190,7 +197,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
self.wfile.write('<html><head><title>%s</title></head></html>' %
time.time())
return True
@ -206,7 +214,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
self.wfile.write('<html><head><title>%s</title></head></html>' %
time.time())
return True
@ -222,7 +231,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
self.wfile.write('<html><head><title>%s</title></head></html>' %
time.time())
return True
@ -238,7 +248,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Cache-Control', 'max-age=60, proxy-revalidate')
self.end_headers()
self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
self.wfile.write('<html><head><title>%s</title></head></html>' %
time.time())
return True
@ -254,7 +265,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Cache-Control', 'max-age=5, private')
self.end_headers()
self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
self.wfile.write('<html><head><title>%s</title></head></html>' %
time.time())
return True
@ -270,7 +282,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Cache-Control', 'max-age=5, public')
self.end_headers()
self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
self.wfile.write('<html><head><title>%s</title></head></html>' %
time.time())
return True
@ -286,7 +299,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Cache-Control', 'public, s-maxage = 60, max-age = 0')
self.end_headers()
self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
self.wfile.write('<html><head><title>%s</title></head></html>' %
time.time())
return True
@ -302,7 +316,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Cache-Control', 'must-revalidate')
self.end_headers()
self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
self.wfile.write('<html><head><title>%s</title></head></html>' %
time.time())
return True
@ -319,7 +334,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Cache-Control', 'max-age=60, must-revalidate')
self.end_headers()
self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
self.wfile.write('<html><head><title>%s</title></head></html>' %
time.time())
return True
@ -335,7 +351,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Cache-Control', 'no-store')
self.end_headers()
self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
self.wfile.write('<html><head><title>%s</title></head></html>' %
time.time())
return True
@ -352,7 +369,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Cache-Control', 'max-age=60, no-store')
self.end_headers()
self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
self.wfile.write('<html><head><title>%s</title></head></html>' %
time.time())
return True
@ -370,7 +388,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Cache-Control', 'no-transform')
self.end_headers()
self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
self.wfile.write('<html><head><title>%s</title></head></html>' %
time.time())
return True
@ -730,12 +749,14 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
# the request URL into this, but we don't care for testing.
nonce_life = 10
stale = False
if not self.server.nonce or (time.time() - self.server.nonce_time > nonce_life):
if (not self.server.nonce or
(time.time() - self.server.nonce_time > nonce_life)):
if self.server.nonce:
stale = True
self.server.nonce_time = time.time()
self.server.nonce = \
_new_md5(time.ctime(self.server.nonce_time) + 'privatekey').hexdigest()
_new_md5(time.ctime(self.server.nonce_time) +
'privatekey').hexdigest()
nonce = self.server.nonce
opaque = _new_md5('opaque').hexdigest()
@ -760,7 +781,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
# Check the 'response' value and make sure it matches our magic hash.
# See http://www.ietf.org/rfc/rfc2617.txt
hash_a1 = _new_md5(':'.join([pairs['username'], realm, password])).hexdigest()
hash_a1 = _new_md5(
':'.join([pairs['username'], realm, password])).hexdigest()
hash_a2 = _new_md5(':'.join([self.command, pairs['uri']])).hexdigest()
if 'qop' in pairs and 'nc' in pairs and 'cnonce' in pairs:
response = _new_md5(':'.join([hash_a1, nonce, pairs['nc'],
@ -845,7 +867,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def ServerRedirectHandler(self):
"""Sends a server redirect to the given URL. The syntax is
'/server-redirect?http://foo.bar/asdf' to redirect to 'http://foo.bar/asdf'"""
'/server-redirect?http://foo.bar/asdf' to redirect to
'http://foo.bar/asdf'"""
test_name = "/server-redirect"
if not self._ShouldHandleRequest(test_name):
@ -868,7 +891,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def ClientRedirectHandler(self):
"""Sends a client redirect to the given URL. The syntax is
'/client-redirect?http://foo.bar/asdf' to redirect to 'http://foo.bar/asdf'"""
'/client-redirect?http://foo.bar/asdf' to redirect to
'http://foo.bar/asdf'"""
test_name = "/client-redirect"
if not self._ShouldHandleRequest(test_name):
@ -1045,7 +1069,8 @@ def main(options, args):
pyftpdlib.ftpserver.logline = line_logger
# Define a customized banner (string returned when client connects)
ftp_handler.banner = "pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__
ftp_handler.banner = ("pyftpdlib %s based ftpd ready." %
pyftpdlib.ftpserver.__ver__)
# Instantiate FTP server class and listen to 127.0.0.1:port
address = ('127.0.0.1', port)
@ -1075,4 +1100,3 @@ if __name__ == '__main__':
options, args = option_parser.parse_args()
sys.exit(main(options, args))

@ -72,16 +72,22 @@ class URLRequestFtpJob : public URLRequestInetJob {
virtual void ContinueNotifyHeadersComplete();
typedef enum {
START = 0x200, // initial state of the ftp job
CONNECTING, // opening the url
SETTING_CUR_DIRECTORY, // attempting to change current dir to match request
FINDING_FIRST_FILE, // retrieving first file information in cur dir (by
// FtpFindFirstFile)
GETTING_DIRECTORY, // retrieving the directory listing (if directory)
GETTING_FILE_HANDLE, // initiate access to file by call to FtpOpenFile
// (if file).
GETTING_FILE, // retrieving the file (if file)
DONE // URLRequestInetJob is reading the response now
// Initial state of the ftp job.
START = 0x200,
// Opening the url.
CONNECTING,
// Attempting to change current dir to match request.
SETTING_CUR_DIRECTORY,
// Retrieving first file information in cur dir (by FtpFindFirstFile).
FINDING_FIRST_FILE,
// Retrieving the directory listing (if directory).
GETTING_DIRECTORY,
// Initiate access to file by call to FtpOpenFile (if file).
GETTING_FILE_HANDLE,
// Retrieving the file (if file).
GETTING_FILE,
// URLRequestInetJob is reading the response now.
DONE
} FtpJobState;
// The FtpJob has several asynchronous operations which happen
@ -108,4 +114,3 @@ class URLRequestFtpJob : public URLRequestInetJob {
};
#endif // NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_

@ -16,8 +16,8 @@ URLRequestJobTracker::URLRequestJobTracker() {
URLRequestJobTracker::~URLRequestJobTracker() {
DLOG_IF(WARNING, active_jobs_.size() != 0) <<
"Leaking " << active_jobs_.size() << " URLRequestJob object(s), this could be "
"because the URLRequest forgot to free it (bad), or if the program was "
"Leaking " << active_jobs_.size() << " URLRequestJob object(s), this could "
"be because the URLRequest forgot to free it (bad), or if the program was "
"terminated while a request was active (normal).";
}
@ -55,4 +55,3 @@ void URLRequestJobTracker::OnBytesRead(URLRequestJob* job,
FOR_EACH_OBSERVER(JobObserver, observers_,
OnBytesRead(job, byte_count));
}

@ -172,7 +172,9 @@ BOOL CALLBACK EnumWindowCallback(HWND hwnd, LPARAM output) {
wchar_t window_title[100 + 1] = {0};
::GetWindowText(hwnd, window_title, 100);
fprintf(reinterpret_cast<FILE*>(output),
"[GRANTED] Found window 0x%p with title %S\r\n", hwnd, window_title);
"[GRANTED] Found window 0x%p with title %S\r\n",
hwnd,
window_title);
::CloseWindow(hwnd);
}
@ -192,4 +194,3 @@ void POCDLL_API TestCloseHWND(HANDLE log) {
// before returning.
::Sleep(3000);
}

@ -236,11 +236,13 @@ bool ServiceResolverThunk::IsFunctionAService(void* local_thunk) const {
// able to patch a buffer in memory, so target_ is not inside ntdll.
module_2 = ntdll_base_;
} else {
if (!GetModuleHandleHelper(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
reinterpret_cast<const wchar_t*>(target_),
&module_2))
if (!GetModuleHandleHelper(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
reinterpret_cast<const wchar_t*>(target_),
&module_2)) {
return false;
}
}
if (module_1 != module_2)
@ -397,4 +399,3 @@ bool Win2kResolverThunk::IsFunctionAService(void* local_thunk) const {
}
} // namespace sandbox

@ -5,8 +5,8 @@
#ifndef SANDBOX_TOOLS_FINDER_STDAFX_H__
#define SANDBOX_TOOLS_FINDER_STDAFX_H__
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#include <stdio.h>

@ -5,8 +5,8 @@
#ifndef SANDBOX_TOOLS_LAUNCHER_STDAFX_H__
#define SANDBOX_TOOLS_LAUNCHER_STDAFX_H__
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#include <stdio.h>